当前位置:网站首页>Understanding of class
Understanding of class
2022-07-03 07:21:00 【four thousand three hundred and forty-three】

package JavaReflcet;
import org.junit.Test;
public class ClassTest {
/*
obtain Class The way of example
*/
@Test
public void test1() throws ClassNotFoundException {
// Mode one : Call the properties of the runtime class : .class
Class clazz = person.class;
System.out.println(clazz);
// The way 2: Through the object of the runtime class
person p1 = new person();
Class<? extends person> clazz2 = p1.getClass();
System.out.println(clazz2);
// The way 3: call Class Static method of :forName(String classPath)
Class clazz3 =Class.forName("JavaReflcet.person");
System.out.println(clazz3);
// The way 4: Using loaders for classes :ClassLoader
ClassLoader classLoader = ReflactionTest.class.getClassLoader();
Class<?> clazz4 = classLoader.loadClass("JavaReflcet.person");
System.out.println(clazz4);
}
}
person The runtime class of can be regarded as a singleton :
clazz == clazz2 //true
clazz2== clazz3 //true
边栏推荐
- Inno Setup 制作安装包
- 2021-07-18
- Shim and Polyfill in [concept collection]
- PHP install the spool extension
- Operation and maintenance technical support personnel have hardware maintenance experience in Hong Kong
- Win 10 find the port and close the port
- Topic | synchronous asynchronous
- Some experiences of Arduino soft serial port communication
- [solved] sqlexception: invalid value for getint() - 'Tian Peng‘
- Advanced APL (realize group chat room)
猜你喜欢

1. E-commerce tool cefsharp autojs MySQL Alibaba cloud react C RPA automated script, open source log

“百度杯”CTF比赛 2017 二月场,Web:爆破-1

Final, override, polymorphism, abstraction, interface

docker建立mysql:5.7版本指定路径挂载不上。

JUC forkjoinpool branch merge framework - work theft
![[solved] unknown error 1146](/img/f1/b8dd3ca8359ac9eb19e1911bd3790a.png)
[solved] unknown error 1146
![[set theory] partition (partition | partition example | partition and equivalence relationship)](/img/f0/c3c82de52d563f3b81d731ba74e3a2.jpg)
[set theory] partition (partition | partition example | partition and equivalence relationship)
![[set theory] equivalence classes (concept of equivalence classes | examples of equivalence classes | properties of equivalence classes | quotient sets | examples of quotient sets)*](/img/1f/f579110a408c5b5a094733be57ed90.jpg)
[set theory] equivalence classes (concept of equivalence classes | examples of equivalence classes | properties of equivalence classes | quotient sets | examples of quotient sets)*

VMWare网络模式-桥接,Host-Only,NAT网络

高并发内存池
随机推荐
File operation serialization recursive copy
专题 | 同步 异步
PHP install composer
Gridome + strapi + vercel + PM2 deployment case of [static site (3)]
Operation and maintenance technical support personnel have hardware maintenance experience in Hong Kong
【无标题】
Recursion, Fibonacci sequence
SecureCRT取消Session记录的密码
Circuit, packet and message exchange
C code production YUV420 planar format file
PHP install the spool extension
[solved] unknown error 1146
【已解决】Unknown error 1146
3311. 最长算术
4279. 笛卡尔树
Advanced API (batch image Download & socket dialog)
万卷书 - 价值投资者指南 [The Education of a Value Investor]
Jeecg data button permission settings
C代码生产YUV420 planar格式文件
Advanced API (multithreading 02)