顯示具有 Class 標籤的文章。 顯示所有文章
顯示具有 Class 標籤的文章。 顯示所有文章

2013年8月28日

Java─getclass() 用途

Use Object.getClass(). It returns the runtime type of the object.

Object instance = new SomeClass();
instance.getClass().getName(); //will return the name (as String) (== "SomeClass")
instance.getClass(); //will return the SomeClass' Class object
參考連結