1.

Which of these is an incorrect array declaration?(a) int arr[] = new int[5](b) int [] arr = new int[5](c) int arr[] = new int[5](d) int arr[] = int [5] newThe question was asked during an interview.My doubt is from Arrays topic in chapter Data Types, Variables and Arrays of Java

Answer» CORRECT choice is (d) int arr[] = int [5] new

Easy explanation: Operator new must be SUCCEEDED by array TYPE and array SIZE.


Discussion

No Comment Found

Related InterviewSolutions