1/45
This flashcard set covers the essentials of Java's Math class, character handling, String object methods, and output formatting as presented in CSC110 AB.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
Sequence
A control structure where statements execute one after another from top to bottom.
Selection
A control structure where a decision is made based on a boolean condition.
==
The comparison operator used to check for equality in a condition.
=
The assignment operator used to set the value of a variable.
Fall-through
A situation in a switch statement where forgetting a break causes all cases below the match to execute.
&&
The AND boolean operator which is true only if both conditions are true.
∣∣
The OR boolean operator which is true if at least one condition is true.
!
The NOT boolean operator which flips the boolean value.
Math Class
A built-in Java toolkit that provides static methods for common mathematical operations and requires no import.
Math.abs(x)
Returns the absolute value or distance from zero for the provided number.
Math.pow(base, exponent)
Returns the value of the base raised to the power of the exponent as a double.
Math.sqrt(x)
Returns the square root of the specified value.
Math.ceil(x)
Rounds a decimal number UP to the nearest whole number.
Math.floor(x)
Rounds a decimal number DOWN to the nearest whole number.
Math.round(x)
Rounds a number to the nearest whole number integer.
Math.random()
Returns a pseudo-random double value in the range [0.0, 1.0).
Random Integer Formula
The expression (int)(Math.random() * range) + min where range is max - min + 1; used to generate integers within a specific inclusive range.
Pseudo-random Numbers
Numbers generated by deterministic algorithms that are predictable if the starting seed is known.
Seed
An initial value that determines the entire sequence of numbers generated by a random number generator.
Math.PI
A built-in constant representing the ratio of a circle's circumference to its diameter, approximately 3.141592653589793.
char
A primitive type that stores a single character wrapped in single quotes, such as ’A’.
Unicode
A universal encodings system used by Java that assigns a unique number to every character in every language.
ASCII
The first 128 characters of the Unicode set, including standard English letters and numbers.
\text{\n}
The escape sequence for a new line.
\text{\t}
The escape sequence for a horizontal tab.
\text{\"}
The escape sequence for a double quote.
\text{\}
The escape sequence for a backslash.
Character.isDigit(c)
A static method that returns true if the specified character is a digit.
Character.isLetter(c)
A static method that returns true if the specified character is a letter.
Object
A variable that has both data (information) and behaviors (methods), stored as a reference to a memory address.
String
An object type in Java that stores a sequence of characters wrapped in double quotes.
length()
A String method that returns the number of characters in the string, including spaces and punctuation.
charAt(i)
A String method that returns the character at the specific index i, where the first character is at index 0.
Concatenation
The process of joining strings together using the + operator.
trim()
A String method that removes leading and trailing spaces from a string.
next()
A Scanner method that reads one word and stops at a space or Enter key.
nextLine()
A Scanner method that reads the entire line, including spaces, and stops only at the Enter key.
equals()
The method used to compare the content of two strings for an exact, case-sensitive match.
compareTo()
A method that returns 0 if strings are equal, a negative value if the string comes before another alphabetically, or a positive value if it comes after.
substring(start, end)
Extracts a portion of a string from the start index up to, but not including, the end index.
indexOf()
Searches for a character or substring and returns its position, or −1 if not found.
printf
A method used for formatted output, providing precise control over alignment, decimal places, and columns.
%d
A printf format specifier used for integers.
%s
A printf format specifier used for strings.
%.2f
A printf format specifier used to display a decimal number with two decimal places.
Text Block
A multi-line string starting and ending with triple quotes ("""), introduced in Java 15+ to preserve formatting without escape sequences.