public String toString() {
return getClass().getName(); // 等同于 this.getClass().getName()
}
getClass() 是 Object 的 final 實例方法,只能通過對象調用。this.。this.getClass() 與 getClass() 編譯為相同字節碼,運行效率無差異。可加 this. 增強可讀性(明確指明調用者),但非強制。靜態方法中無 this,不可調用 getClass()。