O'Reilly logo

Programmer's Guide to Java™ Certification, A: A Comprehensive Primer, Second Edition by Rolf W. Rasmussen, Khalid A. Mughal

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Review Questions

10.16 Which of the following operators cannot be used in conjunction with a String object?

Select the two correct answers.

  1. +

  2. -

  3. +=

  4. .

  5. &

10.17 Which expression will extract the substring "kap" from a string defined by String str = "kakapo"?

Select the one correct answer.

  1. str.substring(2, 2)

  2. str.substring(2, 3)

  3. str.substring(2, 4)

  4. str.substring(2, 5)

  5. str.substring(3, 3)

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required