面向对象2

package oop;

public class Demo02 {
   public static void main(String[] args) {
       //静态方法:static
      /* Student.say();*/
       //非静态方法
       //对象类型 对象名= new 对象值;
      Student student=new Student();
      student.say();
  }
}
package oop;
//学生类
public class Student {
   //方法
   //非静态方法
   public  void say(){
       System.out.println("学生说话了");
  }
}
package oop;

public class Demo03 {
   public static void main(String[] args) {
       //和类一起加载的
     
  }
   public static void a(){
       b();
  }
   public static void b(){
       a();
  }


}
package oop;
//值传递

public class Demo04 {
   public static void main(String[] args) {
       int a=1;
       System.out.println(a);
       Demo04.change(a);
       System.out.println(a);
  }
   //返回值为空
   public static void change(int a){
       a=10;
  }
}
package oop;
//引用传递:对象,本质还是值传递
public class Demo05 {
   public static void main(String[] args) {
      Person person= new Person();
       System.out.println(person.name);
       Demo05.change(person);
       System.out.println(person.name);
  }
   public static void change(Person person){
       //person是一个对象:指向的--》Person person=new Person();这是一个具体的人,可以改变属性!
       person.name="顾文杰";
  }
}
//定义了一个类person,有一个属性:name
class Person{
   String name;//默认值=null;
}

这里有个疑问,为啥person类值变了