Can someone explain why i cannot use array={a,b}; :
public class Example {
private final String a;
private final String b;
public final String[] array;
public Example(){
a="test";
b="text";
//String [] c = {a,b}; This is fine
//array=c;
array={a,b}; // this line throws an Exception
}
}
Exception :
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - illegal start of expression
at Example.<init>(Example.java:21)
at hello.main(hello.java:26)
Java Result: 1