Character and String Class Methods Flashcards
A String variable is not a simple data
type but a reference—it holds a
________________, not the actual
value.
memory address
Provides methods to manipulate and inspect
single-character data
Character class
Used to store a single character, such as a
letter, digit, or punctuation mark.
Char data type
Used for fixed (unchanging) text data made
up of one or more characters.
String Class
Java also provides a __________ class for working
with characters.
Character
This class includes useful methods for testing and
manipulating _______________.
character values
The Character class is part of the _______________, which is automatically imported into every Java program.
java.lang
package
Java provides tools to make working with text
easier, including classes like ____________ and ____________.
Character and String
Checks if the given character is a letter
(uppercase or lowercase).
isLetter(char ch)
Checks if the given character is a digit
(0-9).
isDigit(char ch)
Checks if the given character is a
whitespace (space, tab, newline, etc.).
isWhitespace(char ch)
Converts the given character to its
uppercase equivalent.
toUppercase(char ch)
Converts the given character to its
lowercase equivalent.
toLowerCase(char ch)
Checks if the given character is an
uppercase letter.
isUpperCase(char ch)
Checks if the given character is a
lowercase letter.
isLowerCase(char ch)
Converts the given character to a
String.
toString(Char ch)
Checks if the given character is a letter
or a digit.
isLetterOrDigit(char ch)
Compares two characters numerically
based on their Unicode values.
compare(char x, char y)
compare(char x, char y)
Compares two characters ___________ based on their _________ values.
numerically, Unicode
_________ are one of the most common
dataType in Java.
Strings
Strings are __________—they are never
changed.
immutable
It is a String that uses double quotes with no characters
inside, e.g., String word1 = “ “;.
Empty String
Returns the number of characters in a String.
Length()
Finds the position of a character or substring in a String.
IndexOf()