10.28 |
What will be the result of attempting to compile and run the following program? public class MyClass { public static void main(String[] args) { String s = "hello"; StringBuffer sb = new StringBuffer(s); sb.reverse(); if (s == sb) System.out.println("a"); if (s.equals(sb)) System.out.println("b"); if (sb.equals(s)) System.out.println("c"); } } Select the one correct answer.
|
10.29 |
What will be the result of attempting to compile and run the following program? public class MyClass { public static void main(String[] args) { StringBuffer sb = new StringBuffer("have a nice day"); sb.setLength(6); System.out.println(sb); } } Select the one correct answer.
|
10.30 |
Which of these parameter lists have a corresponding constructor in the StringBuffer class? Select the three correct answers.
|
10.31 |
Which method is not defined in the StringBuffer class? Select the one correct answer.
|
10.32 |
What will be the result of attempting to compile and run the following code? public class StringMethods { public static void main(String[] args) { String str = new String("eenny"); str.concat(" meeny"); StringBuffer strBuf = new StringBuffer(" miny"); strBuf.append(" mo"); System.out.println(str + strBuf); } } Select the one correct answer.
|