Java Progress:extends
//Name:Extends
//Description:Practise using extends
//Auther:CrackCell
//Date:26-Jan-07
class Human{
String name=null;
int sex; //0=male,1=female
Human(){
System.out.println("Human");
}
}
class Student extends Human{
String studentID;
Student(){
System.out.println("Student.");
}
}
public class Extends{
public static void main(String[] args){
Student S1=new Student();
S1.name="TanMenglong";
S1.sex=0;
S1.studentID="200632580051";
System.out.println(S1.name);
}
}
1 comment:
I am using it now. Thx
Post a Comment