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

String name = "Testbook";

for (int i = 0; i <  name.length; i++)

System.out.println(name.charAt(i));

1
i++ should be i + 1 
2
name.length should be name.length() 
3
i < name.length()  should be ​i <= name.length() 
4
name.charAt(i) should be name[i]

Sponsored

hivanix.in

Visit

This quiz is brought to you by hivanix.in

🌐 Web App Development

Quick Navigation