Java String Flashcards

1
Q

It contains a collection of Unicode Characters surrounded by double quotes

A

String

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

Used for storing text

A

String

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

The length of a string can be found with the Length
property.

A

String length

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

Syntax of string length

A

identifier.length()

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

Returns the uppercase equivalent of the argument; no change is made if the argument is not a lowercase letter.

A

String toUpperCase

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

Syntax of String toUpperCase

A

identifier.toUpperCase()

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

Returns the lowercase equivalent of the argument; no change is made if the argument is not an uppercase letter.

A

String toLowerCase

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

Method of combining two strings or more than string at once

A

StringConcatenation

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

You can access the characters in a string by referring to its index number
inside.

A

String charAt

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

Syntax of String charAt

A

identifier.charAt(index number)

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

You can also find the index position of a specific character in a string, by using the indexOf() method

A

String indexOf

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

It extracts the characters from a string, starting from the specified
character position/ index and returns a new string.

A

String substring()

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

Syntax of String substring()

A

identifier.substring(index)

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

Contains standard methods for testing the values of characters

A

Character class

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

Returns true if the arguement is a digit (0-9) and false otherwise

A

Character.isDigit()

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

Returns true if the arguement is a letter and false otherwise

A

Character.isLetter()

17
Q

Returns true if the arguement is a letter or digit and false otherwise

A

Character.isLetterorDigit()

18
Q

Returns true if the arguement is whitespace and false otherwise

A

Character.isWhitespace()

19
Q

Each take a String argument and return true or false if a String object does or does not end or start with the specified argument.

A

endsWith() & startsWith() method

20
Q

Allows you to replace all occurrences of some character within a String.

A

replace() method

21
Q

The method returns true if the objects have identical contents

A

equals() method

22
Q

You can compare one string to another.

A

compareTo() method

23
Q

Format a string with as many characters as are needed

A

%s

24
Q

Format a string with the specified number of characters, and right justify

A

%15s

25
Q

Format string with the specified number of characters, and left justify

A

%-15s

26
Q

Format a string with as many numebers as are needed

A

%d

27
Q

Format a string with a specified number of integers, will pad with spaces to the left if not enough integers

A

%15d

28
Q

Format a string with a specified number of integers, will pad with zeros to the left if not enough integers

A

%04d

29
Q

Format string with as many numbers as are needed. Will always give you six decimal places

A

%f

30
Q

Format string with as many numbers as are needed. Gives 2 decimal places

A

%.2f

31
Q

The whole string occupies 10 characters. If there’s not enough numbers, then spaces are used to the left of the numbers

A

%10.2f