Java Quick Reference

studied byStudied by 0 people
0.0(0)
Get a hint
Hint

String(String str)

1 / 23

flashcard set

Earn XP

Description and Tags

Java Quick Reference Sheet

24 Terms

1

String(String str)

Constructs a new String object that represents the same sequence of characters as str

New cards
2

int length()

Returns the number of characters in a String object

New cards
3

String substring(int from, int to)

Returns the substring beginning at index from and ending at index to - 1

New cards
4

String substring(int from)

Returns substring(from, length())

New cards
5

int indexOf(String str)

Returns the index of the first occurrence of str; returns -1 if not found

New cards
6

boolean equals(String other)

Returns true if this is equal to other; returns false otherwise

New cards
7

int compareTo(String other)

Returns a value <0 if this is less than other; returns zero if this is equal to other; returns a value >0 if this is greater than other

New cards
8

Integer(int value)

Constructs a new Integer object that represents the specified int value

New cards
9

Integer.MIN_VALUE

The minimum value represented by an int or Integer

New cards
10

Integer.MAX_VALUE

The maximum value represented by an int or Integer

New cards
11

int intValue()

Returns the value of this Integer int

New cards
12

Double(double value)

Constructs a new Double object that represents the specified double value

New cards
13

double doubleValue()

Returns the value of this Double as a double

New cards
14

static int abs(int x)

Returns the absolute value of an int value

New cards
15

static double abs(double x)

Returns the absolute value of a double value

New cards
16

static double pow(double base, double exponent)

Returns the value of the first parameter raised to the power of the second parameter

New cards
17

static double sqrt(double x)

Returns the positive square root of a double value

New cards
18

static double random()

Returns a double value greater than or equal to 0.0 and less than 1.0

New cards
19

int size()

Returns the number of elements in the list

New cards
20

boolean add(E obj)

Appends obj to end of list; returns true

New cards
21

void add(int index, E obj)

Inserts obj at position index (0 <= index <= size), moving elements at position index and higher to the right (adds 1 to their indices) and adds 1 to size

New cards
22

E get(int index)

Returns the element at position index in the list

New cards
23

E set(int index, E obj)

Replaces the element at position index with obj; returns the element formerly at position index

New cards
24

E remove(int index)

Removes element from position index, moving elements at position index + 1 and higher to the left (subtracts 1 from their indices) and subtracts 1 from size; returns the element formerly at position index

New cards

Explore top notes

note Note
studied byStudied by 17 people
... ago
5.0(1)
note Note
studied byStudied by 208 people
... ago
5.0(2)
note Note
studied byStudied by 13 people
... ago
5.0(1)
note Note
studied byStudied by 8 people
... ago
5.0(1)
note Note
studied byStudied by 6 people
... ago
5.0(1)
note Note
studied byStudied by 8 people
... ago
5.0(1)
note Note
studied byStudied by 36 people
... ago
5.0(1)
note Note
studied byStudied by 1806 people
... ago
4.7(6)

Explore top flashcards

flashcards Flashcard (105)
studied byStudied by 8 people
... ago
5.0(1)
flashcards Flashcard (119)
studied byStudied by 8 people
... ago
5.0(1)
flashcards Flashcard (21)
studied byStudied by 12 people
... ago
5.0(1)
flashcards Flashcard (121)
studied byStudied by 13 people
... ago
5.0(1)
flashcards Flashcard (23)
studied byStudied by 7 people
... ago
5.0(1)
flashcards Flashcard (77)
studied byStudied by 156 people
... ago
4.8(5)
flashcards Flashcard (48)
studied byStudied by 2 people
... ago
5.0(1)
flashcards Flashcard (159)
studied byStudied by 1982 people
... ago
4.5(13)
robot