mingcheng
public class ZhangRuiTest {
public static void main(String[] args) {
Auto zr =new Auto(0);
Auto e=new Auto(100);
zr.start();
zr.speedup();
zr.stop();
e.start();
}
}
Auto
public class Auto {
int speed;
Auto(int speed){
this.speed=speed;
}
Auto(){}
void start(){
System.out.println("Car start");
}
void speedup(){
System.out.println("Car Speedup");
}
void stop(){
System.out.println("Car stop");
}
}
Student
public class Student {
private String name;
private int age;
private String sex;
Student(String name,int age,String sex){
this.name=name;
this.age=age;
this.sex=sex;
}
Student(){}
void sayHello(){
System.out.println("Hello everyone");
}
void selfInfo(){
System.out.println("My name is "+ this.name+
",age is"+this.age+",sex is"+this.sex);
}
}