forked from AndrewProgramming/JavaTutorialCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest01.java
More file actions
31 lines (18 loc) · 667 Bytes
/
Test01.java
File metadata and controls
31 lines (18 loc) · 667 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package reflection;
public class Test01 {
public static void main(String[] args)
throws ClassNotFoundException, IllegalAccessException, InstantiationException {
Class c1 = Class.forName("reflection.User");
System.out.println(c1);
Class c2 = Class.forName("reflection.User");
Class c3 = Class.forName("reflection.User");
Class c4 = Class.forName("reflection.User");
System.out.println(c2.hashCode());
System.out.println(c3.hashCode());
System.out.println(c4.hashCode());
//User user1 = new User();
User user2= (User) c1.newInstance();
boolean t = user2 instanceof User;
System.out.println(t);
}
}