1/36
Looks like no tags are added yet.
class
defines a new data type. It is the formal implementation, or blueprint, of the attributes and behaviors of the objects of that class
object
a specific instance of a class with defined attributes. _____ are declared as variables of a class type
constructors
code that is used to create new objects and initialize the object’s attributes
new
keyword used to create objects with a call to one of the class’s constructors
instance variables
define attributes for objects; typically private
(instance) methods
define the behaviors or functions for objects
static methods
methods that belong to the class itself rather than to any specific instance/object of the class
dot (.) operator
used to access an object’s methods
parameters (arguments)
the values or data passed to an object’s method inside the parentheses in the method call to help the method do its job
return values
values returned by methods to do the calling method
immutable
String methods do not change the String object. Any method that seems to change a string actually creates a new string
new
is used to create a new object
null
is used to indicate that an object reference doesn’t refer to any object yet
String(String str)
Constructs a new String object that represents the same sequences of characters as str
int length()
returns the number of characters in a String object
String substring(int from, int to)
returns the substring beginning at index from and ending at index (to-1). The single element substring at position index can be created by calling substring(index, index+1)
String substring(int from)
returns substring(from, length())
int indexOf(String str)
returns the index of the first occurrence of str; returns -1 if not found
boolean equals(Object other)
returns true if this (the calling object) is equal to other; returns false otherwise
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.
Integer(value)
Constructs a new integer object that represents a specified int value
Integer.MIN_VALUE
The minimum value represented by an int or integer
Integer.MAX_VALUE
The maximum value represented by an int or integer
Int IntValue()
Returns the value of this Integer as an int
Double(double value)
Constructs a new Double object and represents that specified double value
double doubleValue()
Returns the value of this Double as a double
int abs(int)
Returns the absolute value of an int value (which means no negatives)
double abs(double)
returns the absolute value of a double value
double pow(double,double)
Returns the value of the first parameter raised to the power of the second parameterd
double sqrt(double)
Returns the positive square root of a double value
double random()
Returns a double value greater than or equal to 0.0 and less than 1.0 (not including 1.0)
(int)(Math.random()*range) + min
moves the random number into a range starting from a minimum number. The range is the (max number - min number + 1)
Example: to get a number in the range of 5 to 10, use the range 10-5 + 1 = 6 and the min number 5: (int)(Math.random()&6) + 5)
object
a specific instance of a class with defined attributes
class
defines a new data type with instance variables and methods
methods
define the behaviors or functions for objects
constructors
code that is used to create new objects and intialize the object’s attributes
parameters
the values or data passed to an object’s method