父与子
package bao1;
public class Student {
String name="abc"; // 定义一个成员变量name
private void SetName(String name) { // 定义一个参数(局部变量)name
this.name = name; // 将局部变量的值传递给成员变量
}
}
class small_Student extends Student{
int tag;
public void func(){
System.out.println("小学生!");
}
}
class big_Student extends Student{
int tag;
public void func(){
System.out.println("大学生!");
}
}
package bao1;
public class wsdx{
public static void main(String[] arg){
small_Student Student1=new small_Student();
System.out.println(Student1.name);
}
}