I wrote some code as follow:
public class MyClass {
public static void main(String[] args) {
printIt(getLong());
System.out.println("---------");
}
public static Object printIt(Object... objects) {
System.out.println(objects[0].toString());
return objects[0];
}
public static <T> T getLong() {
return (T)Long.valueOf(1L);
}
}
When I run it, it throws java.lang.ClassCastException as follow:
Exception in thread "main" java.lang.ClassCastException: java.lang.Long cannot be cast to [Ljava.lang.Object; at com.sealinetech.MyClass.main(MyClass.java:5)
But when I debug it with Evaluate Expression, It's OK Evaluate Expression is OK
My IDE is intellij
, and the JDK version is jdk1.8.0_144