What correction is required for following Java code snippet to compile?

int [ ] X = new int [10];

for (int P = 0; P <= X.length (); P++)

X [P] = 5;  

1
P <= X.length() should be ​P < X.length
2
P++ should be P + 1 
3
X.length() should be X.length 
4
X[P] = 5 should be X(P) = 5  

Sponsored

hivanix.in

Visit

This quiz is brought to you by hivanix.in

🌐 Web App Development

Quick Navigation