/*
* * caryt * */class test1{ String thh="caryt1";}/**
* * caryt * */ public class test { static void test2(test1 t3){ t3.thh="caryt3"; } /** * args */ public static void main(String[] args) { // TODO Auto-generated method stub test1 t1=new test1(); test1 t2=new test1();t2.thh="caryt2";
System.out.println("t1:"+t1.thh+" t2:"+t2.thh);
t1=t2;
System.out.println("t1:"+t1.thh+" t2:"+t2.thh);
test2(t1);System.out.println("t1:"+t1.thh+" t2:"+t2.thh);
}
}
out: t1:caryt1 t2:caryt2
t1:caryt2 t2:caryt2t1:caryt3 t2:caryt3