Solved

Is the Code Snippet Written Below Legal? String S =

Question 21

Multiple Choice

Is the code snippet written below legal? String s = "1234";
For (int i = 0; i <= 5; i++)
{
System.out.print) ;
}


A) Yes.
B) No; there should be a semicolon at the end of line 2.
C) No; for i = 4, s.substring(i, i + 1) will result in an StringIndexOutOfBounds error.
D) No; line 4 should have no semicolon at the end.

Correct Answer:

verifed

Verified

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

Related Questions