package com.oop.demo01;//值传递publicclassDemo04{publicstaticvoidmain(String[] args){int a =1;
System.out.println(a);//1
Demo04.change(a);
System.out.println(a);//1}//返回值为空publicstaticvoidchange(int a){
a =10;}}
package com.oop.demo01;//引用传递:对象,本质还是值传递//对象 ,内存!publicclassDemo05{publicstaticvoidmain(String[] args){
Person person =newPerson();
System.out.println(person.name);//null
Demo05.change(person);
System.out.println(person.name);//Yoona}publicstaticvoidchange(Person person){//person是一个对象:指向的--->Person person = new Person();具体的人可以改变属性!
person.name ="Yoona";}}//Person 内部类,有个属性:nameclassPerson{
String name;//null}