填空题java源代码,java程序编程填空题及答案
java程序填空题!!!设计一个学生类Student,其属性有name(姓名)、age(年龄)和degree(学位)。
class Student{
专注于为中小企业提供成都网站建设、网站设计服务,电脑端+手机端+微信端的三站合一,更高效的管理,为中小企业关岭免费做网站提供优质的服务。我们立足成都,凝聚了一批互联网行业人才,有力地推动了数千家企业的稳健成长,帮助中小企业通过网站建设实现规模扩充和转变。
private String name;
private int age;
private String degree;
public Student(String name, int age, String degree) {
super();
this.name = name;
this.age = age;
this.degree = degree;
}
public Student() {
super();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getDegree() {
return degree;
}
public void setDegree(String degree) {
this.degree = degree;
}
public void show(){
System.out.println("姓名:" + this.getName() + ". 年龄:" + this.getAge() + ". 学位:" + this.getDegree() );
}
}
class Undergraduate extends Student{
private String specialty;
public String getSpecialty() {
return specialty;
}
public void setSpecialty(String specialty) {
this.specialty = specialty;
}
public Undergraduate(String name, int age, String degree, String specialty) {
super(name, age, degree);
this.specialty = specialty;
}
public Undergraduate(String name, int age, String degree) {
super(name, age, degree);
}
public void show(){
System.out.println("姓名:" + this.getName() + ". 年龄:" + this.getAge() + ". 学位:" + this.getDegree() + ". 专业:" + this.getSpecialty());
}
}
class Graduate extends Student{
private String direction;
public String getDirection() {
return direction;
}
public void setDirection(String direction) {
this.direction = direction;
}
public Graduate(String name, int age, String degree, String direction) {
super(name, age, degree);
this.direction = direction;
}
public Graduate(String name, int age, String degree) {
super(name, age, degree);
}
public void show(){
System.out.println("姓名:" + this.getName() + ". 年龄:" + this.getAge() + ". 学位:" + this.getDegree() + ". 研究方向:" + this.getDirection());
}
}
public class exp1401 {
public static void main(String[] args) {
Undergraduate stu1=new Undergraduate("张三",23,"本科","工业自动化");
Graduate stu2=new Graduate("李四",27,"硕士","网络技术");
stu1.show();
stu2.show();
}
}
JAVA填空题
1.对象
6.java命令加上的java源文件 3个字节码文件
7,重写 重载、
10.GridLayout
三。
1.文件名为 A.java
2. x str
3.n%k == 0
java程序填空题?
public class Main {
public static void main(String[] args) {
Test test = new Test(true);
}
}
class Test {
public Test(){
System.out.println("Constructor one invoked!");
}
public Test(int x){
//此处添加代码
Test();
System.out.println("Constructor two invoked!");
}
public Test(boolean b){
//此处添加代码
Test(1);
System.out.println("Constructor three invoked!");
}
}
当前题目:填空题java源代码,java程序编程填空题及答案
文章URL:http://ybzwz.com/article/dsicsdg.html