package arraypkg; import java.util.Arrays; public class Main { private static void foo(Object o[]) { System.out.printf("%s", Arrays.toString(o)); } public static void main(String[] args) { Object []o=new Object[]{1,2,3,4,5}; foo(o);
In the previous code snippet, all expressions except the last are compiled and work fine. Although the last statement, which looks about the same as its immediate statement, the compiler throws a compile-time error - the illegal launch of an expression - is not an assertion. Why?
source share