when i do following it prints B
Code: Select all
public class TestClass{
public static void main(String args[ ] ){
Object a, b, c ;
a = new String("A");
b = new String("B");
a = b; //only swipe this code
c = a;
System.out.println(""+c);
}
}
Also in explanation you have mentioned that "..c starts pointing to the string object .." where this happens compile time or run time.?
Please explain more and clear my doubt.