String Methods Video Check

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

The ! (not operator) can be used with the equals method to determine is two Strings are not equal to each other

True

The .compareTo method returns a boolean (true or false).

False

The length method returns the number of characters in the specified string (excluding spaces)

False

Consider the following code segment: String newString = "Welcome"; String anotherString = "Home"; newString = anotherString + "Hello"; What is the value of newString?

HomeHello

Which of the following would extract "for" from: String motto = "May the force be with you.";

String result = motto.substring(8,11);

Which method would be used to find the index of a particular character in a string?

indexOf()

Which of the following returns the last character of the string str.

str.substring(str.length() -1);

Which method returns a new string that is the same of the original string except all lowercase letters are changed to uppercase letters?

toUpperCase()

Which of the following would be the correct method to extract the word "force" from the string: String motto = "May the force be with you.";

motto.substring(8,13);


Set pelajaran terkait

Week 6 Employee Health and Safety

View Set

Microsoft PowerPoint Mastering for LinkedIn

View Set

Information Systems Management WGU

View Set