new Student().say();
//或者
Student student=new Student();
student.say();
}
//static 的方法是和类一起加载的,存在较早
public static void a(){
// b(); //这里会报错,不能调用!!!!!!!
}
//类实例化之后才存在
public void b(){
}
}
//值传递
public class Demo03 {
public static void main(String[] args) {
int a=1;
System.out.println(a);//1
change(a);
System.out.println(a);//1
}
//返回值为空
public static void change(int a){
a=10;
}
}
//引用传递: 传递的对象,本质还是值传递
//对象要理解透彻、内存要理解透彻!!!!!!!!
public class Demo04 {
public static void main(String[] args) {
评论0