自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(28)
  • 收藏
  • 关注

原创 多功能按摩椅的应用

public interface Music{ public abstract void listenMusic();}public interface Massage{ public abstract void getMassage();}public interface Video{ public abstract void watchVideo();}public interface Chair{ public abstract void sit();}...

2022-05-31 11:39:19 364

原创 面板的简单应用

import java.awt.BorderLayout;import java.awt.Button;import java.awt.Color;import javax.swing.JFrame;import javax.swing.JPanel;public class JPanelApp extends JFrame{private JPanel panel1,panel2; JPanelApp() { setTitle("面板的应用"); setD...

2022-05-31 11:15:22 175

原创 多行文本域的简单应用

import java.awt.Container;import java.awt.FlowLayout;import javax.swing.JFrame;import javax.swing.JScrollPane;import javax.swing.JTextArea;import javax.swing.event.DocumentEvent;import javax.swing.event.DocumentListener;public class TextAreaApp e.

2022-05-30 17:54:04 296

原创 BorderLayout的简单应用

import java.awt.BorderLayout;import java.awt.Container;import javax.swing.JButton;import javax.swing.JFrame;public class borderLayoutApp extends JFrame{ private JButton northButton,southButton,eastButton,westButton,centerButton; public borderL...

2022-05-30 17:52:33 154

原创 【无标题】单行文本框和密码输入框的简单应用

import java.awt.Container;import java.awt.FlowLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JPasswordField;import javax.swing.JTextField;public

2022-05-25 15:42:21 178

原创 从键盘读取各种类型的数值的方法

import java.util.Scanner;public class Wu{public static void main(String[] args) { Scanner input=new Scanner(System.in); System.out.print("请输入一个byte类型的变量:"); byte bytevalue=input.nextByte(); System.out.print("请输入一个short类型的变量:"); ...

2022-05-17 10:37:50 322

原创 判断输入是负数还是非负数

import java.util.Scanner;public class IfInput{ public static void main(String[] args) { Scanner scanner=new Scanner(System.in); int number=scanner.nextInt(); if(number>=0) { System.out.println("非负数"); }...

2022-05-17 10:30:32 230

原创 简单窗口显示代码

import java.awt.Color;import java.awt.Container;import javax.swing.JFrame;import javax.swing.JLabel;public class SwingWindow extends JFrame{JLabel labell; public SwingWindow() { setTitle("简单Swing窗口"); setDefaultCloseOperation(JFrame...

2022-05-17 10:19:51 348

原创 JFrame中标签与按钮的显示

import java.awt.Container;import javax.swing.ImageIcon;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;public class FrameApp extends JFrame{JLabel label;JButton button1,button2;public FrameApp(){ super("J...

2022-05-17 10:18:56 518

原创 简单的按钮显示

import java.awt.Color;import java.awt.Container;import javax.swing.JButton;import javax.swing.JFrame;public class ButtonApp extends JFrame{JButton button;public ButtonApp(){ super("蓝色"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)...

2022-05-17 10:17:39 46

原创 按钮的事件处理

import java.awt.Color;import java.awt.Container;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JButton;import javax.swing.JFrame;public class Button_Event extends JFrame implements ActionListener{ JButt.

2022-05-17 10:16:36 145

原创 继承关系的子类和父类定义及Teacher对象的定义和实现

class Employee{ public String name; char gender; int age; private double salary; public Employee() { name="Tom"; gender='男'; } public Employee(String n,char g,int a,double s) { name=n; gender=g; ...

2022-05-10 10:23:53 136

原创 用if语句将成绩由百分制转换为等级制

import java.util.Scanner;public class ScoreTransfer{ public static void main(String[] args) { Scanner scanner=new Scanner(System.in); System.out.println("输入分数:"); int score=scanner.nextInt(); if(score>+90) {...

2022-05-10 09:53:22 1650

原创 用switch语句实现将成绩由百分制转化成等级制

import java.util.Scanner;public class ScoreTransferSwitch{ public static void main(String[] args) { Scanner scanner=new Scanner(System.in); System.out.print("请输入分数(0——100):"); int score=scanner.nextInt(); int level=(in...

2022-05-10 09:51:45 4577

原创 猜数游戏

import java.util.Scanner;public class CuessNumber{ public static void main(String[] args) { int count=0; int inputNumber=0; Scanner scanner=new Scanner(System.in); int number=(int)(Math.random()*10+1); System.out.printl...

2022-05-10 09:49:30 271

原创 带标号的break语句的应用

public class BreakApp{ public static void main(String[] args) { outer:for(int i=0;i<10;i++) { System.out.print("i="+i+"\t,j="); for(int j=0;j<=i;j++) { System.out.print(j+"\t"); ...

2022-05-10 09:48:20 185

原创 用do while语句实现猜数游戏

import java.util.Scanner;public class GuessNumberDoWhile{ public static void main(String[] args) { int count=0; int inputNumber; Scanner scanner=new Scanner(System.in); int number=(int)(Math.random()*10+1); System.out.p...

2022-05-10 09:47:11 857

原创 计算1到10的阶乘和

public class FactorialSum{ public static int factorial(int n) { int result=1; for(int i=1;i<=n;i++) { result=result*i; } return result; } public static void main(String[] args) { int su...

2022-05-10 09:45:25 248

原创 使用双重循环计算1到10的阶乘和

public class FactorialSum1{ public static void main(String[] args) { int sum=0; int result=1; for(int i=1;i<=10;i++) { for(int j=1;j<=i;j++) { result=result*j; } ...

2022-05-10 09:43:37 2364

原创 带标号的continue语句的应用

public class SushuContinue{ public static void main(String[] args) { System.out.println(""); loop: for(int i=2;i<100;i++) { for(int j=2;j<i;j++) { if(i%j==0) ...

2022-05-10 09:41:34 255

原创 Functransfer

public class Functransfer{void changex(float x){ System.out.println("x="+x); x*=3.4; System.out.println("x="+x);}public static void main(String[] args){ float d; d=7.8f; System.out.println("未调用时d的值:"+d); Func...

2022-04-30 10:47:27 41

原创 构造方法的重载

public class Human{String name;char sex;int age;Human(String n){ name=n;}Human(String n,char s){ name=n; sex=s;}Human(String n,char s,int a){ name=n; sex=s; age=a;}public static void main(String[] a...

2022-04-30 10:46:20 75

原创 CompareInt

import javax.swing.JOptionPane;public class CompareInt{public static void main(String[] args) { int x,y; String s=JOptionPane.showInputDialog("请输入第一个整数"); x=Integer.parseInt(s); s=JOptionPane.showInputDialog("请输入第二个整数"); ...

2022-04-30 10:44:47 174

原创 【Yi】:

import java.util.Scanner;public class Yi{ public static void main(String[] args) { Scanner scanner=new Scanner(System.in); double high; int radious; double volme,area; radious=scanner.nextInt(); hig...

2022-04-17 15:35:47 67

原创 sanjiaoxing

public class sanjiaoxing{ public static void main(String[] args) { for(int i=1;i<=4;i++) { for(int j=3; i<=j; j--) { System.out.print(" "); } for(int j=1; j<=...

2022-04-17 15:27:21 67

原创 shujuleixing

public class shujuleixing{ public static void main(String[] args) { int a=1; System.out.println(""+a); char b='u'; System.out.printf("%c\n",+b); long c=2; System.out.printf("%4d\n",+c); boolean d=true;...

2022-04-17 15:26:27 53

原创 【san】

public class san{ public static void main(String[] args) { byte b; int i=300; long l=8000; double d=325.561; System.out.println("Conversion of int to byte."); b=(byte)i; System.out.println("i and b"+i+""+b); System.out....

2022-04-16 23:31:10 80

原创 ReferenceDataType

public class ReferenceDataType{int num=2;public static void main(String[] args){ ReferenceDataType t=new ReferenceDataType(); ReferenceDataType age=new ReferenceDataType(); t.num=4; System.out.println("t.num="+t.num+",age.num=...

2022-04-16 22:16:58 115

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除