classtest3_2{publicclassPersonT{publicvoidchange(Personp){p.name="mary";p.age=20;}publicvoidchangeInt(inti){i=8;}publicvoidchange1(Personp){p=newPerson("tom",22);}}public...
class test3_2
{
public class PersonT
{
public void change(Person p)
{
p.name="mary";
p.age=20;
}
public void changeInt(int i)
{
i=8;
}
public void change1(Person p)
{
p=new Person("tom",22);
}
}
public static void main(String[] args)
{
PersonT t=new PersonT();
Person p=new Person("john",18);
Person p1=p;
System.out.println(p);
t.change(p1);
System.out.println(p1);
System.out.println("back value is same or not"+p.equals(p1));
int i=10;
System.out.println("i 's value:"+i);
t.changInt(i);
System.out.println("i 's value:"+i);
t.chang1(p);
System.out.println("p 's value:"+p);
}
class static Person
{
String name;
int age;
public void Person(String name,int age)
{
this.name=name;
this.age=age;
}
}
}
为什么总提示 class static Person需要标示符~大神求解~~~~~~
展开