Home » JAVA Programming » Strings » Question
  1. What is the output of this program?

    public class string_Example
    {
    public static void main(String args[])
    {
    String obj = "I LIKE INTERVIEW MANIA";
    System.out.println(obj.charAt(10));
    }
    }
    1. I
    2. L
    3. K
    4. N
    5. E
Correct Option: E

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



Your comments will be displayed only after manual approval.