var Var1 = ["0"];
var Var2 = ["0"];
var Var3 = ["0"];
var Var4 = ["0"];
How can i form this type of variables in java. This is of JavaScript. I tried something like this, but fail.
Array Var1[] = new["0"];
The syntax differs for Java:
String[] var1 = { "0" };
You can also do this:
String[] var1 = new String[] { "0" };
although the second String[]
is optional in the array declaration.
Also
int[] var1 = { 0 };
for integer types.
See: Arrays