Hi,
Could some one explain why the overriding toString() in class A1 was not called as it is being called on class B1?
note : A1, B1 on different files.
thanks
chi-chih
class A1 {
public static void main(
String args[]) {
Integer a = new Integer(7);
System.out.println("A1 : "+ a);
}
public String toString () {
return " from toString()in A1";
}
}
class B1 {
public static void main(String args[]) {
Integer b = new Integer(7);
System.out.println("B1 : "+ new B1()+b);
}
public String toString () {
return " from toString() in B1";
}
}