i am new in java i don not understand that why exception class reference variable print the message and reference variable of normal class print the eclassname@jsjka why ?
public class Exception11 {
int x,y;
public static void main(String[] args) {
try{
int total;
Exception11 e=new Exception11();
e.x=10;
e.y=0;
total=10/0;
System.out.println("Value of refernce variable: "+e);
System.out.println(total);
} catch (ArithmeticException h) {
System.out.println("number can not divide by the 0 Please try again");
int total;
Exception11 e=new Exception11();
System.out.println("Value of refernce variable: "+e);
System.out.println("Value of refernce variable: "+h);
}
}
}
answer -----------------------------
number can not divide by the 0 Please try again
Value of refernce variable: Exception11@4f1d0d
Value of refernce variable: java.lang.ArithmeticException: / by zero