Any entity that has state and behavior
Object
An Object can be defined as an instance of a -?
Class
An object contains an address and takes up some space in -?
Memory
What two purposes do classes, in the context of java, serve?
Classes are
1. Templates that are used to create objects
2. Define object data types and methods.
A class can also be defined as a blueprint from which you can create an individual -?
Object
Do classes consume any space?
No
OOP vs. POP
Which make development and maintenance easier, as well as provides data hiding ?
OOPs
OOP vs. POP
What does POP stand for?
Procedure Oriented Programming
OOP vs. POP
What does OOP stand for?
Object-oriented programming
OOP vs. POP
Which is it not easy to manage if code grows as project size increases, and global data can be accessed from anywhere?
POP
What is a block of codes similar to the method?
A constructor
When is a constructor called?
When an instance of the object is created, and memory is allocated for the object.
"A special type of method which is used to initialize the object" is what?
A constructor
What is missing from the OOP system in the picture below?
Polymorphism
What is missing from the OOP system in the picture below?
Object
What makes sure that constructors for all of an object's sub-objects are called when an object is created?
The compiler
Why is it called a constructor?
because it constructs the values at the time of object creation
What if your class doesn't have any constructors?
Java compiler creates a default constructor
What are the three rules defined for the constructor?
1. Constructor name must be the same as it's class name
2. A constructor must have no explicit return type
3. A java constructor cannot be abstract, static, final, and synchronized
What are the two types of constructors?
Default constructor
Parameterized constructor
Parameterized vs. Default
Which constructor has a specific number of parameters?
Parameterized constructor
Parameterized vs. Default
Which constructor is a no-args constructor that the Java compiler inserts on your behalf?
Default constructor
In Java, a constructor is just like a - but without return type
Method
Can a constructor be overloaded?
Yes
What is constructor overloading?
A technique of having more than one constructor with different parameter lists. They are arranged in a way that each constructor performs a different task. They are differentiated by the compiler by the number of parameters in the list and their types.
Constructor vs Method
Used to initialize the state of an object.
Constructor
Constructor vs Method
Used to expose the behavior of an object.
Method
Constructor vs Method
Must have a return type
Method
Constructor vs Method
Must not have a return type
Constructor
Constructor vs Method
Invoked implicitly
Constructor
Constructor vs Method
Invoked explicitly
Method
Constructor vs Method
Not provided by the compiler in any case
Method
Constructor vs Method
Provides a default if you don't have any in a class
Constructor
Constructor vs Method
Name must be the same as the class name
Constructor
Constructor vs Method
Name may or may not be the same as class name
Method