-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClassTest.java
More file actions
29 lines (22 loc) · 905 Bytes
/
ClassTest.java
File metadata and controls
29 lines (22 loc) · 905 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 btp.oneP;
public class ClassTest {
public static void main(String[] args) throws InstantiationException, IllegalAccessException {
//System.out.println(Integer.class == int.class);
// Class<Integer> clazz = Integer.class;
// System.out.println(clazz);
// Class<? super Integer> cs = clazz.getSuperclass();
// Object n = cs.newInstance();
// System.out.println(n.getClass());
/*Class<ChildClass> childClass = ChildClass.class;
Class<? super ChildClass> parentClass = childClass.getSuperclass();
Object parentObject = parentClass.newInstance();
System.out.println(parentObject.getClass().newInstance().getClass());*/
Number b =new Integer(2);
//Integer i = Integer.class.cast(b);
Integer i = (Integer)b;
System.out.println(b);
System.out.println(i instanceof Object);
}
}
class ParentClass{}
class ChildClass extends ParentClass{}