class?Student{
專(zhuān)注于為中小企業(yè)提供成都網(wǎng)站建設(shè)、網(wǎng)站設(shè)計(jì)服務(wù),電腦端+手機(jī)端+微信端的三站合一,更高效的管理,為中小企業(yè)關(guān)嶺免費(fèi)做網(wǎng)站提供優(yōu)質(zhì)的服務(wù)。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動(dòng)了數(shù)千家企業(yè)的穩(wěn)健成長(zhǎng),幫助中小企業(yè)通過(guò)網(wǎng)站建設(shè)實(shí)現(xiàn)規(guī)模擴(kuò)充和轉(zhuǎn)變。
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()?+?".?學(xué)位:"?+?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()?+?".?學(xué)位:"?+?this.getDegree()?+?".?專(zhuān)業(yè):"?+?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()?+?".?學(xué)位:"?+?this.getDegree()?+?".?研究方向:"?+?this.getDirection());
}
}
public?class?exp1401?{
public?static?void?main(String[]?args)?{
Undergraduate?stu1=new?Undergraduate("張三",23,"本科","工業(yè)自動(dòng)化");
Graduate?stu2=new?Graduate("李四",27,"碩士","網(wǎng)絡(luò)技術(shù)");
stu1.show();
stu2.show();
}
}
1.對(duì)象
6.java命令加上的java源文件 3個(gè)字節(jié)碼文件
7,重寫(xiě) 重載、
10.GridLayout
三。
1.文件名為 A.java
2. x str
3.n%k == 0
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!");
}
}