java string methods Flashcards

(18 cards)

1
Q

___ is a sequence of character treated as single unit

A

String

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

Strings are ___, once a string is created, it cannot be changed.

A

immutable

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

commonly used string methods

A

.length()
.toLowerCase()
.charAt()
.concat()
.equals()
.replace()
.equalsIgnoreCase()
.trim()
.startWith()
.indexOf()
.endWith()
.toUpperCase()

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

The ___ method returns the length of the string.

A

.length()

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

The ____ method returns the character at the specified index.

A

.charAt()

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

The ___ method it compares the strings, it return true if
arguments are the same sequence of character (case-sensitive)

A

.equals()

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

The ____ method it compares the strings, it return
true if arguments are the same sequence of character but ignoring
case differences.

A

.equalsIgnoreCase()

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

The ____ method checks the string starts with the specified prefix.

A

.startsWith()

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

The _____ method checks the string ends with the specified
prefix.

A

.endsWith()

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

The ____ method converts all characters in a string to
uppercase.

A

.toUpperCase()

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

The ____ method converts all characters in a string to
lowercase

A

.toLowerCase()

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

The ____ method removes whitespace from the beginning and
end.

A

.trim()

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

The ____ method searches for the first occurence of a
character or substring.

A

.indexOf()

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

The ____ method checks if a specified characters exists
within a given string.

A

.contains()

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

The ____ method combine the specified string to the end of the
first string

A

.concat()

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

The ____ method check if the string is empty.

17
Q

The ___ method returns a portion of the string from a given
index.

18
Q

The ____ method replace all occurences of a characters in the
string with new characters.