Public classDemo01 { PublicString A1; Public intA2; PublicDemo01 (String A,inti) {A1=A; A2=i; } Public voidDispose () {A1=NULL; } Public Static voidMain (string[] args) {//TODO auto-generated Method StubDemo01 A =NewDEMO01 ("Test", 3); DEMO01 A3=NewDEMO01 ("Test", 3); if(A = =A3) {System.out.println ("(A = = A3) ..." + "true"); } Else{System.out.println ("(A = = A3) ..." + "false"); } Demo01 A2=A; if(A = =A2) {System.out.println ("(A = = A2) ..." + "true"); } Else{System.out.println ("(A = = A2) ..." + "false"); } a.dispose (); if(A = =A2) {System.out.println ("(A = = A2) ..." + "true"); } Else{System.out.println ("(A = = A2) ..." + "false"); } a3.a1= "Test"; if(A2 = =A3) {System.out.println ("(A2 = = a3) ..." + "true"); } Else{System.out.println ("(A2 = = a3) ..." + "false"); } System.out.println ("*****************************************"); System.out.println ("Equal?" + a.a1 = =a2.a1); }//The following are the output results://(A = = A3) ... false//(A = = A2) ... true//(A = = A2) ... true//(A2 = = a3) ... false// *****************************************//false}
Javase Print Output--------01