i have the following code
public class Check_Garbage {
String a ="Check_Garb age ";
public static void main(String args[]){
Check_Garbage c1 = new Check_Garbage() ;
Check_Garbage c2 = m1(c1);
Check_Garbage c3 = new Check_Garbage() ;
c2 = c3;
}
static Check_Garbage m1(Check_Garbag e obj1){
obj1 = new Check_Garbage() ;
obj1.a="This is a Method Object";
return obj1;
}
}
My doubt is ...the statement
c2 = c3 means the methods of c3 are transferred to c2 or is c2 refering to the methods of c3.
Bacicaly will the methods in c2 work even if c3 is deleted?
Eagerly Looking forward....
public class Check_Garbage {
String a ="Check_Garb age ";
public static void main(String args[]){
Check_Garbage c1 = new Check_Garbage() ;
Check_Garbage c2 = m1(c1);
Check_Garbage c3 = new Check_Garbage() ;
c2 = c3;
}
static Check_Garbage m1(Check_Garbag e obj1){
obj1 = new Check_Garbage() ;
obj1.a="This is a Method Object";
return obj1;
}
}
My doubt is ...the statement
c2 = c3 means the methods of c3 are transferred to c2 or is c2 refering to the methods of c3.
Bacicaly will the methods in c2 work even if c3 is deleted?
Eagerly Looking forward....
Comment