fork download
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));
  }
}
Success #stdin #stdout 0.06s 215488KB
stdin
Standard input is empty
stdout
int
long
class java.lang.String
class [Ljava.lang.String;
int
float
null