Home » JAVA Programming » Strings » Question
  1. What is the output of this program?
    public class Result 
    {
    public static void main(String args[])
    {
    String str1 = "Interview Mania";
    String str2 = str1.substring(0 , 9);
    System.out.println(str2);
    }
    }
    1. Interview
    2. Mania
    3. Interview Mania
    4. Inter
    5. None of these
Correct Option: A

substring(0,9) returns the character from 0 th position to 8th position.



Your comments will be displayed only after manual approval.