Professional Documents
Culture Documents
Inteview - Java Oop
Inteview - Java Oop
Inteview - Java Oop
programming?
is a programming
paradigm that focuses on
using objects to design and
build application.
What is a class?
it is a template of an
object. For example, a class
called animal would give a
blueprint for what an animal
looks like and what an animal
can do.
What is an object?
It is an entity that has
state and behaviour. A state is
the data of an object. The
behaviour is the functionality
of the object
A simple example of an
object would be a Person. A
person has a name, colour or
breed. And their behaviour is
walking.
What is a method?
a method is a set of
statements to perform a task.
What is Method
Overloading?
it is a class that have
multiple method that has the
same name but different
arguments.
What is a constructor?
a special method that is
used to initialized an object.
If we dont declare a
constructor in java, the
compiler builds a default
constructors for that class.
It doesnt have a return
type, and it must have the
same name as the class with
or without parameter.
What is static keyword?
it can call a method or a
variable even though you
didnt instantiate In main
method.
What is this keyword?
it works as a reference to
the current object whose
method is being invoke
What is inheritance?
process of obtaining data
members and methods of one
class to another class.
It represents IS-A
relationship, also known as
parent-child.
In java, the class that is
inherited is called the super
class. And the new class is
called subclass
What is aggregation?
it contains to have
ownership of that class.
It represents HAS-A
relationship
What is Method
Overriding?
it provides
implementation of a method
that is already provided in
super class.
What is super keyword?
refers to the immediate
parent class object.
What is final keyword?
it is used to restrict the
user. It can be applied in
variables and also methods
but you cannot override it.
What is polymorphism?
it is the ability of an
object than can take many
forms. There are 2 types of
polymorphism
Run time is done using
inheritance and interfaces
Compile time is done
using method overloading
What is abstraction?
process of hiding the
zimplementation details and
showing only the functionality
to the user.
In other words user will
have the information on what
the object does instead of how
it does it.
What is encapsulation?
process of wrapping
code and data in a single
unit.
Use
setters and getters
method to modify and
view the variables
What is an interface?
it is a blueprint of class
that have static constants and
abstract methods.
What is a package?
it is a namespace that
organizes a set of related
classes or interfaces.
HOW TO DECLARE A
CLASS:
You declare a class by
specifying class keyword
followed the class name that
you want.
HOW TO CREATE AN
OBJECT:
You can create an object
using new keyword.
For example, Person p1
= new Person(); , the person
CONCRETE METHOD:
ABSTRACT METHOD:
abstract void eat()
Abstract methods are
those who need to
implemented in subclass.
They are only defined in super
class but with no body.
WHAT IS DESIGN
PATTERN?
Solution to general problems
that software developers faced during
software development
Factory Design
Pattern
It allows you to create
objects without specifying the
exact class of object that will
be created.
For example you need to
create an interface
second is create a class
that will implement the
interface
third Is to create a
factory to generate object of
concrete class.
Lastly, use the factory to
get the object of concrete
class
MVC DESIGN
PATTERN
MVC stands for model view
controller pattern.
Model represents the POJO.
And also it contains the
business logic.
View represents the
visualization of the data
POINT OF SALE
SYSTEM