当前位置:网站首页>Three ways of reflection
Three ways of reflection
2022-06-11 02:57:00 【ambition_ forever】
public class ReflectionDemo {
public static void main(String[] args) {
Class <?> cls = String.class; // It is only suitable for those that have been specified to operate before compilation Class
try{ // The full pathname of the class has been specified
Class <?> c= Class.forName("java.lang.String");
String s=(String)c.newInstance();
}catch(Exception e){
System.out.println(e.getMessage());
}
//3、 Suitable for cases with object examples
String str = new String();
System.out.println(str.getClass());
}
}
边栏推荐
- [implementation of bubble sorting]
- CPT 102_ LEC 13-14
- One line of code solves the problem that the time to fetch datetime from MySQL database is less than eight hours
- Write my Ini configuration file error
- The two request sessionids of the same user are inconsistent ----- record the problem
- Byte beating | the first batch of written examination for game R & D post (question solution)
- Link list of high frequency written interview question brushing summary (distribution explanation & code annotation)
- Istio安装与使用
- 13. numeric array
- Problems with JDBC tool classes
猜你喜欢

2022年熔化焊接与热切割操作证考试题库及答案

完成千万元A轮融资,小象生活能否成为折扣界的“永辉”?

银行选择电子招标采购的必要性

Tests logiciels vocabulaire commun anglais

Go语言之Go 快速入门篇(一):第一个 Go 程序

靠贴牌飞利浦冲击上市,德尔玛的自有品牌又该如何“起跳”?

Arduino uno connected to jq8900-16p voice broadcast module

【斐波那契数列】

How to add cookie pop-up window in WordPress website (without plug-in)

Introduction to the functions of today's headline search webmaster platform (portal)
随机推荐
学习太极创客 — ESP8226 (二)
List filtering, sorting, verification and other processing methods
[MySQL 45 -10] Lesson 10 how MySQL selects indexes
CPT 102_ LEC 15
Go 语言的优势和学习路线图
Forest v1.5.22 release! Kotlin support
RS232/RS485转4G DTU 上传基于Modbus协议的温湿度传感器数据到远程TCP服务器
Istio安装与使用
靠贴牌飞利浦冲击上市,德尔玛的自有品牌又该如何“起跳”?
Flink开发环境搭建及WordCount
微信小程序
完成千万元A轮融资,小象生活能否成为折扣界的“永辉”?
OpenJudge NOI 1.13 17:文字排版
AOSP ~ logcat chatty line expired
AOSP ~ 默认开启开发者模式
CPT 102_ LEC 18
Win10 安装Office 2016出现错误代码30204-44怎么处理?
出栈序列是否是入栈序列
HUST软件工程(实验2)--TDD测试驱动开发实验。
[long time series prediction] aotoformer code detailed [3] model overall architecture analysis