1
visibility

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(4));
}
}

  • A

    E

  • B

    I

  • C

    L

  • D

    K

charAt() is a method of class String which gives the character specified by the index. obj.charAt(4) gives 5th character i:e K.