引用类型变量--------存地址
public class Test{
public static voud ,ain(String[] args){
Student s=new Student();
System.out.println(s.name);
System.out.println(s.chinese);
System.out.println(s.math);
Student s1 = Student();
s1.name = "张三";
Student s2 = Student();
s2.name = "李四";
System.out.println(s1.name);
}
}
s1,s2如果谁null就无法执行
构造器
封装------------合理隐藏--合理暴露
public class Test{
public static void main(String[] args){
Student s1 = new Student();
s1.setScore(99);
System.out.println( s1.setScore(99))
}
}