Vocab Flashcards
(35 cards)
Wrapper class
Wrapper classes provide a way to use primitive data types (int, boolean, etc..) as objects.
Use the capitals: Int not int
Autoboxing
automatic conversion that the Java compiler makes between the primitive types and their corresponding object wrapper classes
this
refers to the current object in the method or constructor
new
used to create a new instance of a class
Static variables
variables lifetime is the full time the program is running
Static method
-method belongs to the class not the instance of the class
-method is accessible to every instance of a class but methods defined in an instance are only able to be accessed by that object of the class
Instance variables
variable which is declared in a class but outside of constructors, methods, or blocks
Instance Constants
variable whose value never changes
Polymorphism
ability of a class to provide different implementations of a method, depending on the type of object that is passed to the method
Inheritance
create new classes that inherit features of the superclass
super
constructor call
super.method()
call parent method
default access
same class and same package
private access
only that class
protected access
Same class, same package, and different package subclass
public access
yes
abstract class
restricted class that cannot be used to create objects
abstract method
-no body
-can only be used in an abstract class
interface
-a completely “abstract class” that is used to group related methods with empty bodies
-may not have member variables or method definitions
typecast
assign a value of one primitive data type to another type
instance of
test whether the object is an instance of the specified type (class or subclass or interface)
abstract class vs interface
Abstract classes can have methods with implementation whereas interface provides absolute abstraction and can’t have any method implementations.
Enumerated Types
type whose legal values consist of a fixed set of constants
ex)fall winter spring summer
Array
int[] myNum = {10, 20, 30, 40};
myNum[2];
arr = insertX(n, arr, x, pos);