350). Which of these operators can be used to concatenate two or more String objects?

[A]+
[B]+=
[C]&
[D]||

Show Answer

351). Which of this method of class String is used to obtain a length of String object?

[A]get()
[B] Sizeof()
[C]lengthof()
[D] length()

Show Answer

354). Which of these is an incorrect statement?

[A] String objects are immutable, they cannot be changed
[B]String object can point to some other reference of String variable
[C]StringBuffer class is used to store string in a buffer for later use
[D] None of the mentioned

Show Answer

355). 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);
            System.out.println(s);
        }
   }

[A]a
[B]b
[C]c
[D]abc

Show Answer

356). What will be the output of the following Java program?
    class String_demo 
    {
        public static void main(String args[])
        {
            int ascii[] = { 65, 66, 67, 68};
            String s = new String(ascii, 1, 3);
            System.out.println(s);
        }
   }

[A]ABC
[B]BCD
[C]CDA
[D]ABCD

Show Answer

357). 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);
        }
   }

[A] 3 0
[B]0 3
[C]3 4
[D] 4 3

Show Answer