java学习45天2020/8/19
public class people{ protected int age; protected String name; public people(int a,String m) { age=a;name=m; } public void setvalue(int a,String m) { age=a;name=m; } public void play() { System.out.println(age+" "+name); } }
public class student11 extends people {
protected int ID;
public student11() {
super(24,"asd");
};
public student11(int a,String m,int b)
{
super(a,m);
ID=b;
}
public void setid(int a)
{
ID=a;
}
public void playid()
{
System.out.println(ID);
}
public static void main(String [] args)
{
student11 s=new student11(25,"asd",001);
s.setvalue(21,"sdf");
s.setid(002);
s.play();
s.playid();
}
}
三例题