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

    public class Result
    {
    public static void main(String args[])
    {
    String ch = "Hello i love Interview mania";
    int start = 13;
    int end = 28;
    char str[]=new char[end-start];
    ch.getChars(start,end,str,0);
    System.out.println(str);
    }
    }
    1. Hello i
    2. love Interview
    3. love Interview mania
    4. Hello i love Interview mania
    5. i love Interview mania
Correct Option: E

getChars(start,end,str,0) returns an array from the string c, starting index of array is pointed by start and ending index is pointed by end. s is the target character array where the new string of letters is going to be stored and the new string will be stored from 0th position in str.



Your comments will be displayed only after manual approval.