Java StackTraceElement getClassName()方法与示例
StackTraceElement类的getClassName()方法 (StackTraceElement Class getClassName() method)
getClassName() method is available in java.lang package.
getClassName()方法在java.lang包中可用。
getClassName() method is used to retrieve the fully qualified name of the class that contains the execution point denoted by this element.
getClassName()方法用于检索包含此元素表示的执行点的类的完全限定名称。
getClassName() method is a non-static method, it is accessible with the class object only and if we try to access the method with the class name then we will get an error.
getClassName()方法是一个非静态方法,只能通过类对象进行访问,如果尝试使用类名访问该方法,则会收到错误消息。
getClassName() method does not throw an exception at the time of returning class name.
返回类名时, getClassName()方法不会引发异常。
Syntax:
句法:
public String getClassName();
Parameter(s):
参数:
It does not accept any parameter.
它不接受任何参数。
Return value:
返回值:
The return type of this method is String – it returns the fully qualified name of the class that contains the starting point denoted by this element.
此方法的返回类型为String –它返回包含此元素表示的起点的类的完全限定名称。
Example:
例:
// Java program to demonstrate the example
// of String getClassName() method of StackTraceElement
import java.io.*;
import java.util.*;
public class GetClassName {public static void main(String args[]) {System.out.println("Class name of all threads included :");
for (int k = 0; k < 2; ++k) {// Display class name
System.out.println(Thread.currentThread().getStackTrace()[k].getClassName());
}
}
}
Output
输出量
Class name of all threads included :
java.lang.Thread
GetClassName
翻译自: https://www.includehelp.com/java/stacktraceelement-getclassname-method-with-example.aspx
Java StackTraceElement getClassName()方法与示例相关推荐
- Java IOUtils.copy方法代码示例(亲测)
本文整理汇总了Java中org.apache.commons.io.IOUtils.copy方法的典型用法代码示例.如果您正苦于以下问题:Java IOUtils.copy方法的具体用法?Java I ...
- java user directory,Java ProcessBuilder directory()方法与示例
语法:public File directory (); public ProcessBuilder directory (File dir); ProcessBuilder类directory()方 ...
- Java序列化魔术方法及其示例使用
在上一篇文章中, 您需要了解有关Java序列化的所有知识 ,我们讨论了如何通过实现Java序列化来启用类的可序列化性. Serializable接口. 如果我们的类未实现Serializable接口, ...
- catalog java,Java Connection getCatalog()方法与示例
通常,目录是一个目录,其中包含有关数据集,文件或数据库的信息.而数据库目录中包含所有数据库,基本表,视图(虚拟表),同义词,值范围,索引,用户和用户组的列表. Connection接口的getCata ...
- filepermission java,Java FilePermission getActions()方法与示例
FilePermission类getActions()方法getActions()方法在java.io包中可用. getActions()方法用于检查此FilePermission和给定对象在路径名和 ...
- java方法参数Bundle,Java ResourceBundle keySet()方法及示例
ResourceBundle类keySet()方法keySet()方法在java.util包中可用. keySet()方法用于从此ResourceBundle及其超级捆绑包中获取所有现有键,以在Set ...
- java exec waitfor,Java Process waitFor()方法与示例
流程类waitFor()方法在java.lang包中提供了waitFor()方法. waitFor()方法用于使当前正在运行的线程在需要时等待,直到由该Process对象表示的进程完成其终止为止. 当 ...
- java arraylist.add(),Java ArrayList add()方法与示例
ArrayList类add()方法 语法:public boolean add(T ele); public void add(int indices, T ele);add()方法在java.uti ...
- java rollback用法,Java Connection rollBack()方法与示例
回滚操作将撤消当前事务所做的所有更改,即,如果调用Connection接口的rollBack()方法,则所有修改都将还原到最后一次提交. 您还可以通过将所需的Savepoint对象作为参数传递给此方法 ...
最新文章
- 10000字的Pandas核心操作知识大全!
- 因果表征学习最新综述:连接因果科学和机器学习的桥梁
- mini2440系统引导(四)存储控制器
- 结构体中string类型成员
- Android短消息备份闪退,Android Socket发送信息时闪退
- 使用OpenCV进行相机标定
- 女生心中的理想男生!这些条件你符合几条?
- mysql多数据源切换_CI 多数据库操作 切换数据库
- C++:vs2017编写代码时的光标变成了黑块,选中字时替换掉了黑块选中的字【解决办法】
- 设置darktable为中文
- 分类与回归机器学习模型的评价指标
- MicroPython实例之TPYBoard v102炫彩跑马灯WS2812B
- 搭建Hexo博客并部署到Github
- 详细设计说明书评测规范
- 【数据库】数据库的锁机制及原理
- lync前段服务器证书安装,Lync Server 2013企业版部署测试六:前端服务器安装Lync Server系统...
- 计算机程序漏洞用英语怎么说,网络用语bug是什么意思,中文翻译是虫子(指电脑程序漏洞)...
- 低功耗蓝牙(BLE)开发——如何妥善处理包大小(MTU)限制
- 毫米波技术入局智能家居,是大材小用还是技术革命?
- WinEdt教程 表格,图像,公式,段落
热门文章
- 日常问题——pdsh localhost Connection refused
- Java @Transient 注解使用
- 前端请求进化之路--从form表单到JSONP
- java.util.Date和java.sql.Date 一点区别
- Linux学习第三步(Centos7安装mysql5.7数据库)
- iOS开发之解决系统数字键盘无文字时delete键无法监听的技巧
- Failed connect to github.com:443; No error
- 昨天安装复习中遇到的问题小结
- char与varchar区别(MYISAM)
- Failed to load or instantiate TagLibraryValidator class: org.apache.taglibs.standard.tlv.JstlFmtTLV