关于Java的一个小程序,懂得来帮个忙

作者&投稿:妫诚 (若有异议请与网页底部的电邮联系)
两个java小程序 高手帮个忙~

//3.1背着书包买书
public class Test{
public static void main(String[] args) {
Student s = new Student();
Bag b = s.getBag();
s.goToShop();
b.getBook();
}
}

class Student{
Student(){
System.out.print("学生");
}

Bag getBag(){
System.out.print("背");
return new Bag();
}
void goToShop(){
System.out.print("去书店");
}


}

class Bag{
Bag(){
System.out.print("书包");
}
Book getBook(){
System.out.print("买");
return new Book();
}
}

class Book{
Book(){
System.out.print("书");
}
}

//******************************************************
//3.2 人的特点




public class Person {
private int year = 2011;
private String name;
private String ID;
private String birthday;
private boolean sex;
private int age;
public Person() {}
public Person(String name, String iD) {
this.name = name;
ID = iD;
this.setAge();
this.setSex();
this.setBirthday();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getID() {
return ID;
}
public void setID(String iD) {
ID = iD;
}
public String getBirthday() {
return birthday;
}
public void setBirthday() {
this.birthday = ID.substring(6,14);
}
public boolean isSex() {
return sex;
}
public void setSex() {
this.sex = Integer.parseInt(ID.substring(16,17))%2==0;
}
public int getAge() {
return age;
}
public void setAge() {
this.age = year - Integer.parseInt(ID.substring(6,10));
}

}

set ws=createobject("wscript.shell")
ws.run "路径est.bat",0

复制的.VBS文件就行

这是我编过的程序
它用来计算两个日期之间间隔
某日期向前/后几天是什么日期(考虑闰年)
星期几不好算,肯定要找个基准点

import java.awt.*;
import java.awt.event.*;

public class dakiler
{
public static void main(String args[])
{
new mainpage();
}
}

class mainpage extends Frame implements ActionListener
{
private Button button2,button3,button4;
forward frame1;
backward frame2;
twodates frame3;
mainpage()
{
super("主选择页面");
this.setLayout(new FlowLayout());
this.setLocation(250,250);

button2=new Button("日期向后计算");
button3=new Button("日期向前计算");
button4=new Button("两个日期计算");

button2.addActionListener(this);
button3.addActionListener(this);
button4.addActionListener(this);

this.add(button2);
this.add(button3);
this.add(button4);

this.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
}
);

this.pack();
this.show();
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==button2)
{
this.setLocation(0,0);
forward frame1=new forward();

}
if(e.getSource()==button3)
{
this.setLocation(0,0);
backward frame2=new backward();
}

if(e.getSource()==button4)
{
this.setLocation(0,0);
twodates frame3=new twodates();
}
this.pack();
}
}

*/

class mainpage extends Frame implements ItemListener
{
private Choice choice;
private Label label1;
forward frame1;
backward frame2;
twodates frame3;
mainpage () {
this.setLayout(null);
this.setBounds(250,250,150,90);

choice=new Choice();
label1=new Label("请选择");

choice.addItem("日期向后计算");
choice.addItem("日期向前计算");
choice.addItem("两个日期计算");

choice.addItemListener(this);
label1.setBounds(20,30,100,20);
choice.setBounds(20,50,100,20);
this.add(label1);
this.add(choice);

this.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
}
);

this.show();
}

public void itemStateChanged(ItemEvent e)
{
if(choice.getSelectedItem().equals("日期向后计算"))
{
this.setLocation(0,0);
if (frame1!=null) frame1.dispose();
if (frame2!=null) frame2.dispose();
if (frame3!=null) frame3.dispose();
frame1=new forward();
}
if(choice.getSelectedItem().equals("日期向前计算"))
{
this.setLocation(0,0);
if (frame1!=null) frame1.dispose();
if (frame2!=null) frame2.dispose();
if (frame3!=null) frame3.dispose();
frame2=new backward();
}
if(choice.getSelectedItem().equals("两个日期计算"))
{
this.setLocation(0,0);
if (frame1!=null) frame1.dispose();
if (frame2!=null) frame2.dispose();
if (frame3!=null) frame3.dispose();
frame3=new twodates();
}
}

}

class forward extends Frame implements ActionListener
{
private Button button5,button6;
private TextField yeartextfield,monthtextfield,daytextfield,timetextfield,answertextfield;
private Label yearlabel,monthlabel,daylabel,timelabel,answerlabel;
private double year,month,day,time;
private boolean isren,iscontinue;
forward()
{
super("日期向后计算");
this.setLayout(null);
this.setBounds(0,250,800,150);
this.setResizable(false);

button5=new Button("确定");
button6=new Button("清除");

yearlabel=new Label("请输入年份");
monthlabel=new Label("请输入月份");
daylabel=new Label("请输入日期");
timelabel=new Label("请输入向后几天");
answerlabel=new Label("答案是");

yeartextfield=new TextField(5);
monthtextfield=new TextField(5);
daytextfield=new TextField(5);
timetextfield=new TextField(5);
answertextfield=new TextField(20);

button5.addActionListener(this);
button6.addActionListener(this);

yeartextfield.addActionListener(this);
monthtextfield.addActionListener(this);
daytextfield.addActionListener(this);
timetextfield.addActionListener(this);

yearlabel.setBounds(0,50,100,20);
yeartextfield.setBounds(100,50,100,20);
monthlabel.setBounds(0,80,100,20);
monthtextfield.setBounds(100,80,100,20);
daylabel.setBounds(0,110,100,20);
daytextfield.setBounds(100,110,100,20);
timelabel.setBounds(200,80,100,20);
timetextfield.setBounds(300,80,100,20);
button5.setBounds(400,80,100,20);
button6.setBounds(500,80,100,20);
answerlabel.setBounds(600,80,100,20);
answertextfield.setBounds(700,80,100,20);

this.add(yearlabel);
this.add(yeartextfield);
this.add(monthlabel);
this.add(monthtextfield);
this.add(daylabel);
this.add(daytextfield);
this.add(timelabel);
this.add(timetextfield);
this.add(button5);
this.add(button6);
this.add(answerlabel);
this.add(answertextfield);

this.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
dispose();
}
}
);

this.show();
}

public void actionPerformed(ActionEvent e)
{
if (e.getSource()==button6)
{
yeartextfield.setText("");
monthtextfield.setText("");
daytextfield.setText("");
timetextfield.setText("");
answertextfield.setText("");
}
else if((e.getSource()==button5)||(e.getSource()==yeartextfield)||(e.getSource()==monthtextfield)||(e.getSource()==daytextfield)||(e.getSource()==timetextfield))
{

try
{
year=Double.parseDouble(yeartextfield.getText());
month=Double.parseDouble(monthtextfield.getText());
day=Double.parseDouble(daytextfield.getText());
time=Double.parseDouble(timetextfield.getText());
}
catch (Exception exc)
{
iscontinue=false;
answertextfield.setText("输入不正确");
}
function func=new function();
isren=func.ren(year);
iscontinue=false;
iscontinue=func.conti(month,day,isren);

if(iscontinue)
{
String str=func.plus(year,month,day,time);
answertextfield.setText(str);
}
else
{ answertextfield.setText("输入不正确");
}
}

}
}

class backward extends Frame implements ActionListener
{
private Button button5,button6;
private TextField yeartextfield,monthtextfield,daytextfield,timetextfield,answertextfield;
private Label yearlabel,monthlabel,daylabel,timelabel,answerlabel;
private double year,month,day,time;
private boolean isren,iscontinue;
backward()
{
super("日期向前计算");
this.setLayout(null);
this.setBounds(0,250,800,150);
this.setResizable(false);

button5=new Button("确定");
button6=new Button("清除");

yearlabel=new Label("请输入年份");
monthlabel=new Label("请输入月份");
daylabel=new Label("请输入日期");
timelabel=new Label("请输入向前几天");
answerlabel=new Label("答案是");

yeartextfield=new TextField(5);
monthtextfield=new TextField(5);
daytextfield=new TextField(5);
timetextfield=new TextField(5);
answertextfield=new TextField(20);

button5.addActionListener(this);
button6.addActionListener(this);
yeartextfield.addActionListener(this);
monthtextfield.addActionListener(this);
daytextfield.addActionListener(this);
timetextfield.addActionListener(this);

yearlabel.setBounds(0,50,100,20);
yeartextfield.setBounds(100,50,100,20);
monthlabel.setBounds(0,80,100,20);
monthtextfield.setBounds(100,80,100,20);
daylabel.setBounds(0,110,100,20);
daytextfield.setBounds(100,110,100,20);
timelabel.setBounds(200,80,100,20);
timetextfield.setBounds(300,80,100,20);
button5.setBounds(400,80,100,20);
button6.setBounds(500,80,100,20);
answerlabel.setBounds(600,80,100,20);
answertextfield.setBounds(700,80,100,20);

this.add(yearlabel);
this.add(yeartextfield);
this.add(monthlabel);
this.add(monthtextfield);
this.add(daylabel);
this.add(daytextfield);
this.add(timelabel);
this.add(timetextfield);
this.add(button5);
this.add(button6);
this.add(answerlabel);
this.add(answertextfield);

this.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
dispose();
}
}
);

this.show();
}

public void actionPerformed(ActionEvent e)
{
if (e.getSource()==button6)
{
yeartextfield.setText("");
monthtextfield.setText("");
daytextfield.setText("");
timetextfield.setText("");
answertextfield.setText("");
}
else if((e.getSource()==button5)||(e.getSource()==yeartextfield)||(e.getSource()==monthtextfield)||(e.getSource()==daytextfield)||(e.getSource()==timetextfield))
{

try
{
year=Double.parseDouble(yeartextfield.getText());
month=Double.parseDouble(monthtextfield.getText());
day=Double.parseDouble(daytextfield.getText());
time=Double.parseDouble(timetextfield.getText());
}
catch (Exception exc)
{
iscontinue=false;
answertextfield.setText("输入不正确");
}
function func=new function();
isren=func.ren(year);
iscontinue=false;
iscontinue=func.conti(month,day,isren);

if(iscontinue)
{
String str=func.minus(year,month,day,time);
answertextfield.setText(str);
}
else
{ answertextfield.setText("输入不正确");
}
}

}
}

class twodates extends Frame implements ActionListener
{
private Button button5,button6;
private TextField yeartextfield1,monthtextfield1,daytextfield1,answertextfield,yeartextfield2,monthtextfield2,daytextfield2;
private Label yearlabel1,monthlabel1,daylabel1,yearlabel2,monthlabel2,daylabel2,answerlabel;
private double year1,month1,day1,year2,month2,day2;
private boolean isren1,isren2,iscontinue;
private int days;

public twodates()
{
super("两个日期计算");
this.setLayout(null);
this.setBounds(0,250,100,800);
this.setSize(800,150);
this.setResizable(false);

button5=new Button("确定");
button6=new Button("清除");

yearlabel1=new Label("请输入第一个年份");
monthlabel1=new Label("请输入第一个月份");
daylabel1=new Label("请输入第一个日期");

yearlabel2=new Label("请输入第二个年份");
monthlabel2=new Label("请输入第二个月份");
daylabel2=new Label("请输入第二个日期");

answerlabel=new Label("答案是");

yeartextfield1=new TextField(5);
monthtextfield1=new TextField(5);
daytextfield1=new TextField(5);

yeartextfield2=new TextField(5);
monthtextfield2=new TextField(5);
daytextfield2=new TextField(5);

answertextfield=new TextField(20);

button5.addActionListener(this);
button6.addActionListener(this);
yeartextfield1.addActionListener(this);
monthtextfield1.addActionListener(this);
daytextfield1.addActionListener(this);
yeartextfield2.addActionListener(this);
monthtextfield2.addActionListener(this);
daytextfield2.addActionListener(this);

yearlabel1.setBounds(0,50,100,20);
yeartextfield1.setBounds(100,50,100,20);
monthlabel1.setBounds(0,80,100,20);
monthtextfield1.setBounds(100,80,100,20);
daylabel1.setBounds(0,110,100,20);
daytextfield1.setBounds(100,110,100,20);
yearlabel2.setBounds(200,50,100,20);
yeartextfield2.setBounds(300,50,100,20);
monthlabel2.setBounds(200,80,100,20);
monthtextfield2.setBounds(300,80,100,20);
daylabel2.setBounds(200,110,100,20);
daytextfield2.setBounds(300,110,100,20);
button5.setBounds(400,80,100,20);
button6.setBounds(500,80,100,20);
answerlabel.setBounds(600,80,100,20);
answertextfield.setBounds(700,80,100,20);

this.add(yearlabel1);
this.add(yeartextfield1);
this.add(monthlabel1);
this.add(monthtextfield1);

this.add(daylabel1);
this.add(daytextfield1);

this.add(yearlabel2);
this.add(yeartextfield2);
this.add(monthlabel2);
this.add(monthtextfield2);
this.add(daylabel2);
this.add(daytextfield2);

this.add(button5);
this.add(button6);
this.add(answerlabel);
this.add(answertextfield);

this.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
dispose();
}
}
);

this.show();
}

public void actionPerformed(ActionEvent e)
{
if (e.getSource()==button6)
{
this.setSize(800,150);
yeartextfield1.setText("");
monthtextfield1.setText("");
daytextfield1.setText("");
yeartextfield2.setText("");
monthtextfield2.setText("");
daytextfield2.setText("");

answertextfield.setText("");
}
else if((e.getSource()==button5)||(e.getSource()==yeartextfield1)||(e.getSource()==monthtextfield1)||(e.getSource()==daytextfield1)||(e.getSource()==yeartextfield2)||(e.getSource()==monthtextfield2)||(e.getSource()==daytextfield2))
{
this.setSize(800,150);
try
{
year1=Double.parseDouble(yeartextfield1.getText());
month1=Double.parseDouble(monthtextfield1.getText());
day1=Double.parseDouble(daytextfield1.getText());
year2=Double.parseDouble(yeartextfield2.getText());
month2=Double.parseDouble(monthtextfield2.getText());
day2=Double.parseDouble(daytextfield2.getText());
}
catch (Exception exc)
{
iscontinue=false;
answertextfield.setText("输入不正确");
}

function func=new function();
isren1=func.ren(year1);
isren2=func.ren(year2);
iscontinue=false;
iscontinue=(func.conti(month1,day1,isren1))&&(func.conti(month2,day2,isren2));

if(iscontinue)
{
days=func.between(year1,month1,day1,year2,month2,day2);
answertextfield.setText("差"+days+"天");
}
else
{ answertextfield.setText("输入不正确");
}
}

}
}

class function
{
private String str;
private int year1,month1,day1,time1;
private int days=0;
private double temp;

public boolean ren(double year)
{
if(((year%4==0)&&(year%100!=0))||(year%400==0))
return true;
else return false;
}

public boolean conti(double month,double day,boolean isren)
{
boolean boo=true;
if((month<=0)||(month>12))
{ boo=false;}
else
{
switch ((int)month)
{
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12: if ((day>31)||(day<=0)) boo=false;
else boo=true;
break;

case 4:
case 6:
case 9:
case 11: if ((day>30)||(day<=0)) boo=false;
else boo=true;
break;

case 2: if (isren)
{
if ((day>29)||(day<=0)) boo=false;
else boo=true;

}
else
{
if ((day>28)||(day<=0)) boo=false;
else boo=true;
}
break;
}
}
return boo;

}

public String plus(double year,double month,double day,double time)
{
year1=(int)year;
month1=(int)month;
day1=(int)day;
time1=(int)time;
for (int i=1;i<=time1;i++)
{
if ((month1==12)&&(day1==31))
{
year1++;
month1=1;
day1=1;
}

else if (((month1==1)||(month1==3)||(month1==5)||(month1==7)||(month1==8)||(month1==10))&&(day1==31))
{
month1++;
day1=1;
}
else if(((month1==4)||(month1==6)||(month1==9)||(month1==11))&&(day1==30))
{


 
 
 
Java 库里有日历类(GregorianCalendar),要好好利用(想知道具体算法的话可以看看随 JDK 一起来的源代码):

import java.util.*;
import java.text.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

class Cal extends JFrame {
    private JTextField year = new JTextField( ),
                       day = new JTextField( ),
                       result = new JTextField( 20 );
    public Cal( ) {
        Container c = getContentPane( );
        c.setLayout( new GridLayout( 4, 2 ) );

        c.add( new JLabel( "年:" ) ); c.add( year );
        c.add( new JLabel( "天:" ) ); c.add( day );

        c.add( new JButton( new AbstractAction( "求结果" ) {
            public void actionPerformed( ActionEvent ae ) {
                int y, d;
                try {
                    y = Integer.parseInt( year.getText( ).trim( ) );
                    d = Integer.parseInt( day.getText( ).trim( ) );
                } catch ( NumberFormatException e ) {
                    JOptionPane.showMessageDialog( Cal.this, "年或天无值或有格式错误" );
                    return;
                }
                GregorianCalendar cal = new GregorianCalendar( y, Calendar.JANUARY, d );
                DateFormat df = new SimpleDateFormat( "M月d日,E,", Locale.CHINESE );
                String leap = ( cal.isLeapYear( y ) ? "" : "不" ) + "是闰年";
                result.setText( df.format( cal.getTime( ) ) + leap );
            }
        } ) );
        c.add( new JLabel( ) );  // 填空

        c.add( new JLabel( "结果:" ) ); c.add( result );

        pack( );
        setLocation( 100, 100 );
        setDefaultCloseOperation( EXIT_ON_CLOSE );
        setVisible( true );
    }

    public static void main( String[ ] args ) { new Cal( ); }
}
 
 
 

如果判断润年,我想大家都知道,只要
year % 4 == 0 && year % 400 != 0
就可以,然后几月几号都可以很容易控制,每个月的天数是一定的,除了润年的二月。
至于你说的星期几,就不容易了,至少我觉得不太容易,如果你自己写函数判断的话。


JAVA的小问题:将26个英文字母存放在一个list集合中,然后从集合中读出显...
public class CollectTest { String str = "abcdefghijklmnopqrstuvwxyz"; ArrayList<String> list = new ArrayList<>(); public void addColectAndPrint() { String[] strings = str.split(""); \/\/ 放在集合里面 for (int i = 0; i < strings.length; i++) { list...

程序设计题:编写一个java小应用程序,要求输出自己的学号,姓名,并写出...
import java.awt.*;\/\/引入包import java.applet.Applet;\/\/引入包public class Output extends Applet\/\/定义类{ \/\/定义变量 private String name; private int num; \/\/初始化 public void init() { name = getParameter("vname"); num = Integer.parseInt(getParameter("vnum")); } \/\/输出 public void pa...

急急急,用JAVA编一个猜数字的小游戏
import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.KeyEvent;import java.awt.event.KeyListener;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JMenu;import javax.swing.JMenuBar;import javax.swing....

JAVA的小问题:将26个英文字母存放在一个list集合中,然后从集合中读出显...
import java.util.ArrayList;import java.util.List;public class Test { public static void main(String[] args) { List<Character> list = new ArrayList<Character>();\/\/定义list for (int i = 65; i < 91; i++) {\/\/利用ascall循环得到A-Z的码 list.add((char)i);\/\/...

求代码:利用Java做一个新的弹出窗口的小程序
文件一父窗文件名Frame3.java package untitled1;import java.awt.BorderLayout;import javax.swing.JFrame;import javax.swing.JButton;import java.awt.*;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;public class Frame3 extends JFrame { JButton jButton1 = new J...

java:编写一个计算器小程序,要求可以做加减乘除运算
private boolean firstDigit = true; \/\/ 标志用户按的是否是整个表达式的第一个数字,或者是运算符后的第一个数字 private double resultNum = 0.0; \/\/ 计算的中间结果 private boolean operateValidFlag = true; \/\/判断操作是否合法 public Calculator(){ super("Calculator");this.setBounds(300, ...

下载完java没有任何文件,只有一个.exe的小东西
如果是xp系统在:C:\\Program Files \\Java有个java文件夹,里面有jdk...、jre...如果是Win7系统在:C:\\Program Files (x86)\\Java也同样有个java文件夹,里面有jdk...、jre...看来是个初学者,多看看书籍、教程、视频就是了。每个人都是从零开始的,没什么大不了,好好学习就是了。

使用java程序接收一个小于10的整数n,计算并输出阶乘.
你好,可以用递归方法实现,以下是实现代码:public class Test { \/ param args \/ public static void main(String[] args) { int n = 0;try{ \/\/ 接收控制台传递参数,并将转化为整数 n = Integer.parseInt(args[0]);}catch(Exception ex){ ex.printStackTrace();System.out.println("请输入...

java做一个计算长方形面积的小程序,怎么限定小数点只能输入一个?怎么...
import java.util.Scanner;import java.text.DecimalFormat;public class Rectangle {public static void main(String[] args) {String str;Double width, length, area;\/\/ 判断小数条件的正则表达式String regEx = "^([1-9][0-9]*)+(.[0-9]{1,1})?$"; Scanner s = new Scanner(System....

老师在java中比较大小用一个变量来用作暂存值是什么意思啊,听不懂...
在Java中,比较大小通常会使用一个变量来暂存比较结果。这是因为比较操作的结果是一个布尔值(true或false),而如果直接将布尔值用于其他操作,可能会产生不符合预期的结果。使用一个变量来暂存比较结果的意思是将比较操作的结果存储在一个变量中,以便后续使用或处理。通过将比较结果存储在变量中,你可以...

枞阳县18560948188: java一个简单小程序,求高手帮忙编写,万分感谢 -
雀供氯唑: class Ball { public void play() { System.out.println("玩球儿..."); } } class Football extends Ball { public void play() { System.out.println("使用足球运动"); } } class Basketball extends Ball { public void play() { System.out.println("...

枞阳县18560948188: 一个简单的java小程序,我是初学者,不要编太难,看不懂 -
雀供氯唑: String s1="sd11"; String s2="22434ssfg11"; ArrayList list=new ArrayList(); for(int i=0;i<s1.length();i++){ //思路是先从s1中按顺序截出字符串然后到s2查看是否含有 for(int j=i+2;j<=s1.length();j++){ String str=s1.substring(i,j);//从s1中去一个大...

枞阳县18560948188: 关于java的一段小程序,各位大牛来帮帮忙啊 -
雀供氯唑: 类的加载过程是这样的1 首先加载要创建对象的类及其直接或间接子类2 在类加载的过程中将静态成员进行加载,主要包括包括静态成员变量的初始化,静态语句块的执行(注:static{ }是静态语句块,这里先执行.输出b)3 需要的类加载完成后,开始创建对象,首先会加载非静态成员,主要包括非静态成员变量的初始化,非静态语句块的执行 (注:这里的{ }是非静态语句块,输出a)4 执行构造器

枞阳县18560948188: 用JAVA编写一个小程序 -
雀供氯唑: import java.io.File; import java.io.IOException; public class CreateFile { public static void main(String[] args) { /*调用File类的构造方法,通过给定的字符串转换成抽象路径名来创建一个file对象*/ File file=new File("D:/letter.txt"); /*如果指定的文件...

枞阳县18560948188: 帮忙编一个JAVA网络小程序,随便一个都行~
雀供氯唑: 聊天系统 客户端类的 so=new Socket("服务端机子的IP",9000); 服务端机子的IP 手动加上去 使用方法: 服务器类在A运行 客户端类在B运行 IP填写A的 就可以聊天了 服务器类 import java.awt.event.ActionEvent; import java.awt.event....

枞阳县18560948188: 急求java的一个小程序
雀供氯唑: public class Sum { public static void main(String[] args) { Scanner ss = new Scanner(System.in); System.out.println("请从键盘上输入一个数字:"); int length = ss.nextInt(); System.out.println(add(length)); }private static int add(int n) { int[] arr ...

枞阳县18560948188: 帮忙编一个java小程序! -
雀供氯唑: import java.awt.*;import java.awt.event.*;import java.math.BigDecimal;class Calculator { private Frame frame; private Panel panel[] = new Panel[6]; private Button botton[] = new Button[25]; private TextField textField; private final String string[] = { "1...

枞阳县18560948188: 求大神给我一个Java语言编写的小程序代码 -
雀供氯唑: public class Dog { private int weigth;//成员属性 public Dog(){//无参构造器 } public Dog(int weigth){//有参构造器 this.weigth=weigth; } public int getWeigth() {//返回Dog的重量weigth return weigth; } public void setWeigth(int weigth) {//设置Dog的...

枞阳县18560948188: 关于java的一个小程序
雀供氯唑: package justfortest; import java.applet.Applet; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; public class Compare extends Applet implements ActionListener { JTextField j1,j2; JLabel jl1; JButton jb; ...

枞阳县18560948188: 求编写一个java小程序.... -
雀供氯唑: 这是以前随便一个简单的网络传输一个图片的小应用,你可以看看参考下.主要就是IO流和Socket的使用...//客户端import java.io.FileOutputStream;import java.io.InputStream...

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 星空见康网