-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathStringConversion.java
36 lines (32 loc) · 1.13 KB
/
StringConversion.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
33
34
35
36
public class StringConversion {
public static void main(String[] args) {
System.out.println("Creating...\n" + new StringConversion() +"\nDone!");
System.out.println("null: " + null);
System.out.println("nullObj: " + nullObj());
System.out.println("nullStr: " + nullStr());
System.out.println("nullToString: " + new NullToString());
System.out.println("byte: " + (byte) 0);
System.out.println("short: " + (short) 0);
System.out.println("char: " + 'a');
System.out.println("int: " + 0);
System.out.println("long: " + 0L);
// System.out.println("float: " + 0.0f); Not implemented yet
// System.out.println("double: " + 0.0); Not implemented yet
System.out.println("bool: " + true);
System.out.println("bool: " + false);
}
public static Object nullObj() {
return null;
}
public static String nullStr() {
return null;
}
public String toString() {
return "StringConversion";
}
public static class NullToString {
public String toString() {
return null;
}
}
}