public class Program { public static void main(String[] args) { int[ ] intArr = new int[6,7,5]; System.out.println(intArr.length); } } | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

public class Program { public static void main(String[] args) { int[ ] intArr = new int[6,7,5]; System.out.println(intArr.length); } }

what is the error??

5th Oct 2016, 6:40 AM
maruf msruf
maruf msruf - avatar
2 Answers
+ 4
The following line is correct for what you want. int[] intArr = {6,7,5}; You are initializing your array incorrectly. You don't need to put "new int". Just put curly braces with the int values you want.
5th Oct 2016, 8:10 AM
Ryne
Ryne - avatar
+ 1
{in this}
5th Oct 2016, 8:19 AM
HawkEye
HawkEye - avatar