-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathClassLiteral.java
32 lines (26 loc) · 1.14 KB
/
ClassLiteral.java
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
30
31
32
class ClassLiteral {
class Inner {}
interface It {}
abstract class Abstract {}
public static void main(String[] args) {
System.out.println(int.class);
System.out.println(ClassLiteral.Inner.class);
System.out.println(Object.class.toString());
System.out.println(byte[].class);
System.out.println(String[][].class);
System.out.println();
System.out.println(new ClassLiteral().getClass());
System.out.println(new Object().getClass());
System.out.println("String".getClass());
// System.out.println(new char[0].getClass()); // TODO
System.out.println();
System.out.println(Object.class == new Object().getClass());
System.out.println(String.class == "String".getClass());
System.out.println(String.class == new Object().getClass());
System.out.println(ClassLiteral.Inner.class
== new ClassLiteral().new Inner().getClass());
// System.out.println(It.class); TODO
System.out.println(Abstract.class);
// System.out.println(short[].class == new short[] {1, 2, 3}.getClass()); TODO
}
}