Problem
Your solution
Test results
Enter your name and class period to start your session.
| Method / Constructor | Description |
|---|---|
String(String str) | Constructs a new String representing the same characters as str |
int length() | Returns the number of characters |
String substring(int from, int to) | Returns substring from index from up to (not including) to |
String substring(int from) | Returns substring(from, length()) |
int indexOf(String str) | Returns index of first occurrence of str; -1 if not found |
boolean equals(Object other) | Returns true if same character sequence as other |
int compareTo(String other) | Returns <0, 0, or >0 based on alphabetical ordering |
String[] split(String del) | Splits the string around matches of del; returns a String array |
| Method / Field | Description |
|---|---|
Integer.MIN_VALUE | The minimum value representable by an int |
Integer.MAX_VALUE | The maximum value representable by an int |
static int parseInt(String s) | Returns the String argument as an int |
| Method | Description |
|---|---|
static double parseDouble(String s) | Returns the String argument as a double |
| Method | Description |
|---|---|
static int abs(int x) | Returns the absolute value of an int |
static double abs(double x) | Returns the absolute value of a double |
static double pow(double base, double exponent) | Returns base raised to the power of exponent |
static double sqrt(double x) | Returns the nonnegative square root of x |
static double random() | Returns a random double where 0.0 <= value < 1.0 |
| Method | Description |
|---|---|
int size() | Returns the number of elements in the list |
boolean add(E obj) | Appends obj to end of list; returns true |
void add(int index, E obj) | Inserts obj at position index, shifting elements right |
E get(int index) | Returns the element at position index |
E set(int index, E obj) | Replaces element at index with obj; returns the old element |
E remove(int index) | Removes element at index, shifting elements left; returns the removed element |
| Method | Description |
|---|---|
boolean equals(Object other) | Returns true if this object is equal to other |
String toString() | Returns a string representation of this object |
| Constructor | Description |
|---|---|
File(String pathname) | Constructs a File object from the given pathname string |
| Method / Constructor | Description |
|---|---|
Scanner(File f) | Constructs a Scanner that reads from the given File |
int nextInt() | Returns the next int from the input; throws InputMismatchException if unavailable or out of range |
double nextDouble() | Returns the next double from the input; throws InputMismatchException if unavailable |
boolean nextBoolean() | Returns the next boolean from the input; throws InputMismatchException if unavailable |
String nextLine() | Returns the next line of text as a String; may return empty string if called immediately after another Scanner method |
String next() | Returns the next token (whitespace-delimited) as a String |
boolean hasNext() | Returns true if there is another token to read; false otherwise |
void close() | Closes this scanner |