I wrote a java program "Test" which is:
class Get{
static void fIntarray(int[] b){
b = {10};
}
}
class Test{
public static void main(String[] args){
int[] a;
Get.fIntarray(a);
System.out.println(a[0]);
}
}
But when I compiled it, the compiler reported following faults:
Test.java:3: error: illegal start of expression
b = {10};
Test.java:3: error:not a statement
b = {10};
Test.java:3: error: ";" expected
b = {10};
Test.java:5: error: class, interface, or enum expected
}
I want to create an integer array a and give value 10 to array a by passing a in the method fIntarray in Get class. I don't know where it's going wrong?