Quiz 3

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

In the Java programming language, strings are Not objects.

False

You would use the length() method to find the length of a string.

True

What is the output of the following program: String a ="Welcome to "; String b = "California!"; b = a + b; System.out.println(b);

Welcome to California!

A string literal is:

a series of characters in your code that is enclosed in double quotes.

The following is the correct syntax to create a string: string greeting = "I Love Java!";

False

What is the output of the following segment of code: String string1 = "Jill went up "; System.out.println("Jack and " + string1 + "the Hill.");

Jack and Jill went up the Hill.

What is the output of this code segment: char[] helloArray = { 'h', 'e', 'l', 'l', 'o', '.' }; String helloString = new String(helloArray); System.out.println(helloString);

hello

If you wanted to get more than one consecutive character which method would you use?

substring()

What method would you call to convert an object that is not a string?

toString()

You can get the character at a particular index within a string by invoking the ____________ accessor method.

NOT: indexAt() stringAt() letterAt()

Methods used to obtain information about an object are known as _______ methods.

accessor

The index of the first character in a string is:

0

What is the output of the following code segment: String s1 = "Hello, how are you?"; int pos = s1.indexOf("how"); System.out.println( "Pos = " + pos );

7

Which of the following operators is used to concatenate strings:

+

As with any other object, you can create String objects by using the ______ keyword and a constructor.

new

The following is allowed in Java: String quote = "Jack and Jill went up the Hill " + "to fetch a pail of water..."

No

What is the output of the following code segment: String s1 = "Love Java!"; System.out.println( "String Length = " + s1.length() );

String Length = 10


Ensembles d'études connexes

Chapter 15: Pain Management During Childbirth

View Set

Macro Economics Chapter 3 Practice Questions

View Set

Lesson 8. I'm not sure if ... / -(으/느)ㄴ지 잘 모르겠어요.

View Set

WEEK 4: LUZON REGIONS "Central Luzon (Region III)"

View Set

Names and Formulas of Chemical Compounds

View Set

Tenses in Active Voice: Which one is correct?

View Set

John Calvin, "Institutes of Christian Religion"

View Set

Nurse logic: Testing & Remediation

View Set

Unit Test #2 Review: Europe and Russia

View Set