hsjl.net
当前位置:首页 >> jAvA简单作业题 >>

jAvA简单作业题

1> 1 2 4 52>1 3 4 5在Java中整型、实型、字符型被视为同一类数据,这些类型由低级到高级分别为(byte,short,char)

public class MyDate {private int year ;private int month ;private int day ;public MyDate(){}public MyDate(int year, int month, int day) {super();this.year = year;this.month = month;this.day = day;}public String toString() {retu...

package my.test.main;import java.util.Scanner;public class Exam {/** * @param args */public static void main(String[] args) {// TODO Auto-generated method stubScanner in = new Scanner(System.in);int score = 0;// 十次循环,出题f...

package jisuanqi; import java.awt.BorderLayout; import java.awt.Dimension; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JButton; import javax.swing.BorderFactory; import java.awt.Rectangle; import ja...

程序及测试结果如下:自己看结果总结一下。可以自己运行,最后设置为1000.更为明显(设置为1000,运行结果太长贴不上) public class MyThread extends Thread { private int i; public void setI(int i){ this.i=i; } public void run(){ for(i...

public class AnimalTest {public static void main(String[] args) {Animal p = new Parrot();p.name = "鹦鹉";zoo z = new zoo();System.out.println(z.free(p));Animal t = new Tortoise();t.name = "乌龟";System.out.println(z.free(t));}}...

1.接口 public interface IShape { public double area( ); } 2.实现类 public class square implements IShape { private int length; public square(int length) { this.length = length; } public double area() { // TODO Auto-generated me...

2个 分别 public Test(){ public Test(String s){} 构造方法是方法名和类旬一样,而且没有返回类型 public void Test(double f) 这个方法有一个空的返回类型,所以不是

// 正好无聊,给你写一个,不过这种作业还是建议自己做 import java.awt.BorderLayout; import java.awt.Component; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.a...

1 C extends 4 C abstract 5 C 2 A 这个是A,因为私有属性可以通过父类的public protected方法(接口)来,严格点说是只能通过方法来访问,而不应该说是接口 二、填空题: 1 多态 封装 继承 抽象 2 x.length = 3; x[0].length = 2 3 new 4 类 5 字...

网站首页 | 网站地图
All rights reserved Powered by www.hsjl.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com