The String Class Flashcards
What is the correct way to compare strings for equality?
equals()
What is the value of x, given the following code?
String letters = “abcdefgh”;
char x = letters.charAt(3);
d
What is the correct way to call a method that takes two parameters?
processData(3,6);
What, if anything, is the value of x given the following code?
String word = "Programming"; var x = word.indexOf('u');
-1
The primitive data type ‘int’ has a corresponding class. How is this class named?
Integer
What method would you typically use to locate the position of the final ‘ri’ in ‘piri-piri’?
lastIndexOf()
What is the effect of String’s trim() method?
Removes all spaces from the start and end of the String.
Which is the correct method name for one which returns the number of characters in the string?
length()
The primitive type char has a corresponding Class. What is it called?
Character