MUST KNOW METHODS Flashcards

(7 cards)

1
Q

indexOf(String)

A

Looks for the 1st occurrence of the specified substring

RETURN AN INT

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

indexOf(String, int)

A

Looks for the occurrence of the substring starting at the specified index (int)
RETURNS AN INT

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

length()

A

Returns the number of characters in the string

RETURNS AN INT

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

valueOf(double)
Float
Int
Object

A

Returns the string representation of the argument
Ex: valueOf(2) = “2”
RETURNS A STRING

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

compareTo(Character)

A

Compares two CHARACTER object numerically

RETURNS AN INT

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

compareTo(String)

A
Compares two strings lexicographically by returning a negative, positive number or zero
RETURNS
NEGATIVE #
POSITIVE #
ZERO
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

charAt(int)

A

Returns a char from the specified index (int)

RETURNS A CHAR

How well did you know this?
1
Not at all
2
3
4
5
Perfectly