Solved

Which of the Following for Loops Is Valid, Given the Following

Question 54

Multiple Choice

Which of the following for loops is valid, given the following declaration?
String[ ] names = {"abc", "def", "ghi", "jkl"};


A) for (int i = 0; i < names.length; i++)
System.out.println(names[i].length) ;
B) for (int i = 0; i < names.length() ; i++)
System.out.println(names[i].length) ;
C) for (int i = 0; i < names.length; i++)
System.out.println(names[i].length() ) ;
D) for (int i = 0; i < names.length() ; i++)
System.out.println(names[i].length() ) ;

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions