61.
What will be the output of the following Java program?
class output 
{
    public static void main(String args[])
    { 
       String s1 = "Hello";
       String s2 = s1.replace('l','w');
       System.out.println(s2);
    }
}

63.
What will be the output of the following Java code?
class output 
{  
    public static void main(String args[]) 
    {  
        StringBuffer sb=new StringBuffer("Hello");  
        sb.replace(1,3,"Java");  
        System.out.println(sb);
    }  
}

64.
In the following Java code, which code fragment should be inserted at line 3 so that the output will be: "123abc 123abc"?
1. StringBuilder sb1 = new StringBuilder("123");
2. String s1 = "123";
3.  // insert code here
4. System.out.println(sb1 + " " + s1);

67.
What will be the output of the following Java code?
class output 
{
    public static void main(String args[])
    { 
       String c = "Hello i love java";
       int start = 2;
       int end = 9;
       char s[]=new char[end-start];
       c.getChars(start,end,s,0);
       System.out.println(s);
    }
}

Read More Section(Strings)

Each Section contains maximum 100 MCQs question on Strings. To get more questions visit other sections.