10.16 |
Which of the following operators cannot be used in conjunction with a String object? Select the two correct answers.
|
10.17 |
Which expression will extract the substring "kap" from a string defined by String str = "kakapo"? Select the one correct answer.
|
10.18 |
What will be the result of attempting to compile and run the following code? class MyClass { public static void main(String[] args) { String str1 = "str1"; String str2 = "str2"; String str3 = "str3"; str1.concat(str2); System.out.println(str3.concat(str1)); } } Select the one correct answer.
|
10.19 |
What function does the trim() method of the String class perform? Select the one correct answer.
|
10.20 |
Which statements are true? Select the two correct answers.
|
10.21 |
Which of these expressions are legal? Select the four correct answers.
|
10.22 |
What will be the result of attempting to compile and run the following code? public class RefEq { public static void main(String[] args) { String s = "ab" + "12"; String t = "ab" + 12; String u = new String("ab12"); System.out.println((s==t) + " " + (s==u)); } } Select the one correct answer.
|
10.23 |
Which of these parameter lists have a corresponding constructor in the String class? Select the three correct answers.
|
10.24 |
Which method is not defined in the String class? Select the one correct answer.
|
10.25 |
Which statement concerning the charAt() method of the String class is true? Select the one correct answer.
|
10.26 |
Which expression will evaluate to true? Select the one correct answer.
|
10.27 |
What will the following program print when run? public class Search { public static void main(String[] args) { String s = "Contentment!"; int middle = s.length()/2; String nt = s.substring(middle-1, middle+1); System.out.println(s.lastIndexOf(nt, middle)); } }; Select the one correct answer.
|