language: Java7 (sun-jdk-1.7.0_10)
date: 256 days 0 hours ago
link:
visibility: public
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
37
38
39
40
41
42
43
44
45
46
47
48
public final class Main {
 
  public static Class<Boolean> typeof(final boolean expr) {
    return Boolean.TYPE;
  }
 
  public static Class<Character> typeof(final char expr) {
    return Character.TYPE;
  }
 
  public static Class<Byte> typeof(final byte expr) {
    return Byte.TYPE;
  }
 
  public static Class<Short> typeof(final short expr) {
    return Short.TYPE;
  }
 
  public static Class<Integer> typeof(final int expr) {
    return Integer.TYPE;
  }
 
  public static Class<Long> typeof(final long expr) {
    return Long.TYPE;
  }
 
  public static Class<Float> typeof(final float expr) {
    return Float.TYPE;
  }
 
  public static Class<Double> typeof(final double expr) {
    return Double.TYPE;
  }
 
  public static Class<?> typeof(final Object expr) {
    return expr == null ? null : expr.getClass();
  }
 
  public static void main(final String[] argv) {
    System.out.println(typeof(500 * 3 - 2));
    System.out.println(typeof(50 % 3L));
    System.out.println(typeof(new String()));
    System.out.println(typeof(argv));
    System.out.println(typeof(argv.length));
    System.out.println(typeof(4f));
    System.out.println(typeof(null));
  }
}