91.
What will be the output of the following Java code?
class output 
{
    public static void main(String args[])
    {
         String chars[] = {"a", "b", "c", "a", "c"};
         for (int i = 0; i < chars.length; ++i)
             for (int j = i + 1; j < chars.length; ++j)
                 if(chars[i].compareTo(chars[j]) == 0)
                     System.out.print(chars[j]); 
    }
}

93.
In the following Java code, what can directly access and change the value of the variable name?
package test;
class Target 
{
 public String name = "hello";
}

94.
Which of the following statement is correct?

95.
What will be the output of the following Java code?
class output 
{
    public static void main(String args[])
    {
       StringBuffer s1 = new StringBuffer("Hello World");
       s1.insert(6 , "Good ");
       System.out.println(s1);
    }
}

96.
What will be the output of the following Java program?
class output 
{
    public static void main(String args[])
    { 
         StringBuffer c = new StringBuffer("Hello");
         StringBuffer c1 = new StringBuffer(" World");
         c.append(c1);
         System.out.println(c);
    }
}

97.
What will be the output of the following Java program?
class String_demo 
{
    public static void main(String args[])
    {
        char chars[] = {'a', 'b', 'c'};
        String s = new String(chars);
        String s1 = "abcd";
        int len1 = s1.length();
        int len2 = s.length();
        System.out.println(len1 + " " + len2);
    }
}

100.
What will be the output of the following Java code?
public class Boxer1 
{
    Integer i;
    int x;
   public Boxer1(int y) 
   {
        x = i+y;
        System.out.println(x);
   }
   public static void main(String[] args) 
   {
       new Boxer1 (new Integer(4));
   }
}

Read More Section(Strings)

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