1/40
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Java
____ is an object-oriented programming language
Object-oriented
______ programming organizes a program around its data and a set of well-defined interfaces to that data
class, instantiated
In Java, the unit of programming is the ___ from which objects are _____
methods, fields
Java classes contain ____ (which implement operations) and ____ (which implement attributes)
class
A ____ is a blueprint from which individual objects are created
class
A class is declared by use of the _____ keyword
Local variables
______ are defined inside methods, constructors or blocks
Instance variables
_____ are variables within a class but outside any method
Class variables, static
______ are variables declared within a class, outside any method, with the ___ keyword
Constructor
_____ in Java is a special type of method that is used to initialize the object
constructor
Every class has a ______
more than one
A class can have _____ constructor
class
The main rule of constructors is that they should have the same name as the ____.
new
In Java, the ___ keyword is used to create new objects
memory, address
The new operator dynamically allocates ____ for an object and returns a reference to it. This reference is the _____ in memory of the object allocated by new keyword
Declaration
Instantiation
Initialization
Three steps to create an object
Declaration
variable declaration (name with an object type)
Instantiation
using the new keyword to create the object
Initialization
new keyword is followed by a call to a constructor
objects
Instance variables are accessed via created _____
First create an object
Call the instance variable
To access an instance variable:
objects
Instance methods are accessed via created _____
First create an object
Call the instance method
To access an instance method:
Java method
A ______ is a collection of statements that are grouped together to perform a specific operation
type modifier
defines the access type of the method and it is optional to use
return type
method may return a value
method name
name of the method
argument list
list of parameters, it is the type, order, and number of parameters of a method. These are optional, method may contain zero parameters
method body
defines what the method does with statements
static
A method that has static keyword is known as ___ method
instance
The method of the class is known as an _____ method
instance method
It is a non-static method defined in the class
object
Before calling or invoking the instance method, it is necessary to create an _______ of its class
accessor, getters
The method that reads the instance variable is known as the _____ method. is also known as _____
get
The accessor method is prefixed with the word ____
private
Accessor method returns and used to get the value of the _____ field
mutator, setters, modifiers
The method that read the instance variable and also modify the values is known as the _____ method. It is also known as _____ or ______
void
The ____ keyword allows us to create methods which do not return a value
public
default
protected
private
Access modifier by hierarchy:
Local variable
Instance variable
Class variable
Types of variables
Static method
Instance method
Accessor method
Mutator method
Types of methods