Java Programming
Accenture PrimermediumJava Programming4. Arrays And Strings

Accenture Java Programming Practice Question

class Output { public static void main(String args[]) { int a1[] = new int[10]; int a2[] = {1, 2, 3, 4, 5}; System.out.println(a1.length + " " + a2.length); } }

Answer options

A
10 5
B
5 10
C
0 10
D
0 5 Array a1 is created so as to contain 10 integer elements. Hence, the length is 10. Array a2 is initialized with 5 values. . Hence, the length is 5. y g

Correct answer: 10 5

Explanation

Correct answer: 10 5.

Related Accenture Java Programming questions

Practice more Accenture Java Programming questions

PrimerDumps has 1400+ primer questions, 2026 mocks and coding hands-on — all free.