私はJavaが初めてなので、例外クラスの参照変数がメッセージを出力し、通常のクラスの参照変数がeclassname@jsjkaを出力する理由がわかりません。
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);
}
}
}
答え - - - - - - - - - - - - - - -
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