[問題] 請問this.getClass().getName()的用法
public class a{
public static void main( String arg[] ) {
System.out.println( this.getClass().getName() );
}
}
-------- 以上是全部的程式碼
以下是compile後的結果
a.java:4: non-static variable this cannot be referenced from a static context
System.out.println( this.getClass().getName() );
^
1 error
請問一下這樣子的寫法哪裡出錯了呢
tks !!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 118.168.93.193
推
11/22 23:14, , 1F
11/22 23:14, 1F
→
11/22 23:40, , 2F
11/22 23:40, 2F
→
11/22 23:42, , 3F
11/22 23:42, 3F
推
11/23 00:09, , 4F
11/23 00:09, 4F