Chapter 7 Flashcards
1
Q
What is each created string?
A
A class object
2
Q
What happens when you use “==” with strings?
A
Comparing computer memory locations, not their values
3
Q
What is a literal string?
A
- A sequence of characters enclosed within double quotation marks
- An unnamed object, or anonymous object, of the string class
4
Q
What is a string variable?
A
- A named object of the string class
- A reference variable
- Refers to a location in memory rather then to a particular value
5
Q
What happens when you try to assign a new value to a String?
A
- The adress held by the string is altered
6
Q
What are immutable objects?
A
- Objects taht cannot be changed, such as a String
- After a string is created, it is Immutable
7
Q
What is the Equals() method?
A
- Returns the content of the two String objects to determine if they are equivalent
8
Q
What is the equalsIgnoreCase() method?
A
- Ignore case when determining if two strings are equivilant
9
Q
What is the compareto() method?
A
- Compares two Strings and returns:
- Zero: if the two strings refer to the same value
- Negative Number: if the calling object is “less than” the argument
- Positive number: “If the calling object is “more than” the argument
10
Q
What are empty strings?
A
- Reference a memory adress with no characters
- Can be used in string methods
11
Q
What are null strings?
A
- Use the null java keyword
- Strings are set to null by default
- Cannot be used in String methods
12
Q
What are the toUpperCase() and toLowerCase() methods?
A
- Convert any styring to its uppercase or lowercase equivilant
13
Q
What is the Length() method?
A
Returns the length of a string?
14
Q
What is the indexOf() method?
A
- Determins weather a specific character occurs within a string
- Returns the position of the character
- The return value is -1 if the character does not exist in the String
15
Q
What is the charAt(0 method?
A
returns the character at the specified index in a string