MUST KNOW METHODS Flashcards
(7 cards)
1
Q
indexOf(String)
A
Looks for the 1st occurrence of the specified substring
RETURN AN INT
2
Q
indexOf(String, int)
A
Looks for the occurrence of the substring starting at the specified index (int)
RETURNS AN INT
3
Q
length()
A
Returns the number of characters in the string
RETURNS AN INT
4
Q
valueOf(double)
Float
Int
Object
A
Returns the string representation of the argument
Ex: valueOf(2) = “2”
RETURNS A STRING
5
Q
compareTo(Character)
A
Compares two CHARACTER object numerically
RETURNS AN INT
6
Q
compareTo(String)
A
Compares two strings lexicographically by returning a negative, positive number or zero RETURNS NEGATIVE # POSITIVE # ZERO
7
Q
charAt(int)
A
Returns a char from the specified index (int)
RETURNS A CHAR