Test1QnA Flashcards
System.out.println()
Prints a message to the console.
Arrays.sort(arr)
Sorts an array in ascending order.
Collections.sort(list)
Sorts a list in ascending order.
LocalDate.now()
Gets the current date.
Files.readAllLines(Path)
Reads all lines from a file into a List<String>.</String>
Math.abs(x)
Returns the absolute value of x.
Math.max(a, b)
Returns the larger of two numbers.
Math.min(a, b)
Returns the smaller of two numbers.
Math.pow(x, y)
Returns x raised to the power of y.
Math.sqrt(x)
Returns the square root of x.
Math.round(x)
Rounds x to the nearest integer.
Math.random()
Returns a random number between 0.0 and 1.0.
str.length()
Returns the length of the string.
str.charAt(index)
Returns the character at the given index.
str.substring(start, end)
Returns a substring from start to end.
str.indexOf(sub)
Returns the index of the first occurrence of sub.
str.equals(anotherString)
Compares two strings for equality.
str.replace(old, new)
Replaces occurrences of old with new.
str.toLowerCase()
Converts the string to lowercase.
str.toUpperCase()
Converts the string to uppercase.
str.trim()
Removes leading and trailing spaces.
Character.isLetter(ch)
Checks if ch is a letter.
Character.isDigit(ch)
Checks if ch is a digit.
Character.isWhitespace(ch)
Checks if ch is a whitespace character.