![]() |
所有类都继承自 Object |
class Personnote:
{
public String name;
public String 地址;
}
class 员工扩展 Person
{
int salary;
public Employee(String name, String address, int salary)
{
this.name=name;
this.address=address;
this.salary=salary;
}
}
class Director extends Person
{
public Director()
{
this.name= name”;
this.adresse= 地址”;
}
}
class Engineer extends Employee
{
public Engineer()
{
super(name”,address”,110);
}
public void concevoir(){System.out.println(我是工程师”);}
public void developper(){};
}
class Accountant extends Employee
{
public Accountant()
{
this.name= name”;
this.adresse= 地址”;
this.salary = 3000;
}
public void manageAccounts(){};
public void gererLesBilans(){};
}
class Ingenieur_reseaux extends Employee如果没有 super,将调用构造函数 Ingénieur_réseaux 中声明的 design() 方法,而不是 engineer 中声明的 design() 方法,因此要引用父方法,您需要添加关键字 super.
{
public Ingenieur_reseaux ()
{
super(name”,address”,3100);
}
public void concevoir(){
super.concevoir();
System.out.println(我设计了公司的网络架构”);
}
}
我是一名工程师
我设计了公司的网络架构
interface print{
void print();
}
interface display{
void display();
}
interface interfaceIA extends print,display{
void imprimer_afficher();
}
class testIA implements interfaceIA{
void print(){System.out.println(Printing”)};
void display(){System.out.println(打印完成”)};
public static void main(){
testIA test = new testIA();
test.print();
test.display();
}
}
Please disable your ad blocker and refresh the window to use this website.