Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

What will be the output of the following Java program?
class string_class
{
public static void main(String args[])
{
String obj = “I LIKE JAVA”;
System.out.println(obj.charAt(3));
}
}

What will be the output of the following Java program?
class string_class
{
public static void main(String args[])
{
String obj = “I LIKE JAVA”;
System.out.println(obj.charAt(3));
}
}
a) I
b) L
c) K
d) E

Answer: a
Explanation: charAt() is a method of class String which gives the character specified by the index. obj.charAt(3) gives 4th character i:e I.

Join The Discussion