java Class.getSimpleName() 詳解及用法
更新時間:2017年02月14日 10:04:28 投稿:lqh
這篇文章主要介紹了java Class.getSimpleName() 詳解及用法的相關(guān)資料,需要的朋友可以參考下
java Class.getSimpleName() 的用法
Usage in android:
private static final String TAG = DemoApplication.class.getSimpleName();
實例代碼:
public class sample{
public static void main(String[] args){
//得到類的簡寫名稱
System.out.println(sample.class.getSimpleName());
//得到對象的全路徑
System.out.println(sample.class);
//得到對象的類模板示例,也就是Class
System.out.println(sample.class.getClass());
//得到Class類的名稱
System.out.println(sample.class.getClass().getName());
}
}
打印結(jié)果為:
sample class com.lovo.test.sample class java.lang.Class java.lang.Class
感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!
相關(guān)文章
springBoot controller,service,dao,mapper,model層的作用說明
這篇文章主要介紹了springBoot controller,service,dao,mapper,model層的作用說明,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2021-11-11
Java 程序設(shè)計總復(fù)習(xí)題(java基礎(chǔ)代碼)
這篇文章主要介紹了Java 程序設(shè)計總復(fù)習(xí)題,主要是java基礎(chǔ)代碼,方便學(xué)習(xí)java的同學(xué)2021-05-05
JAVA | Guava EventBus 使用 發(fā)布/訂閱模式的步驟
這篇文章主要介紹了JAVA | Guava EventBus 使用 發(fā)布/訂閱模式的步驟,幫助大家更好的理解和學(xué)習(xí)使用Guava EventBus,感興趣的朋友可以了解下2021-03-03

