public class My {
float[] arr=new float[]{0.1f,0.2f};
arr[0]=0.2f;
public static void main(String []args) {
My my= new My();
System.out.println(my.arr[0]);
}
}
I got errors:
My.java: 4 : error: ']' expected
arr[0]=0.2f;
^
My.java: 4 : error: ';' expected
arr[0]=0.2f;
^
My.java: 4 : error: illegal start of type
arr[0]=0.2f;
^
My.java: 4 : error: <identifier> expected
arr[0]=0.2f;
^
Is there any way to use arr[0]=somevalue; ? Like they do in C?