Professional Documents
Culture Documents
EMAIL: iaturay214@ccmtsl.com
Q. Explain the main concepts of OOP?
Answer.
To start with, OOP stands for object oriented programming. So therefore these concepts in Java for
instance are the main ideas behind Java’s Object Oriented Programming. These main concepts are:
Abstraction, Encapsulation, Inheritance, and Polymorphism. Grasping them is the key to understanding
how Java works. Basically, Java OOP concepts let us create working methods and variables, then re-use all
or part of them without compromising security.
There are four main OOP concepts in Java which are briefly explained taking key notes to cognizance.
Encapsulation. This is the practice of keeping fields within a class private, then providing access
to them via public methods. It’s a protective barrier that keeps the data and code safe within
the class itself. This way, we can re-use objects like code components or variables without
allowing open access to the data system-wide.
Polymorphism. This Java OOP concept lets programmers use the same word to mean different
things in different contexts. One form of polymorphism in Java is method overloading. That’s
when different meanings are implied by the code itself. The other form is method overriding.
That’s when the different meanings are implied by the values of the supplied variables. See
more on this below.
Answer.
In object oriented programming a Class is a blueprint or a set of instructions to build a specific type of
object. It is a basic concept of Object-Oriented Programming which revolve around the real-life entities.
Class in Java determines how an object will behave and what the object will contain. That is to say, an
object is an instance of a class.
Page 1 of 4
Syntax
class <class_name> {
field;
method;
}
To start with, Classes and Objects in Java are the fundamental components of OOP's.
A Class in object oriented programming is a blueprint or prototype that defines the variables and the
methods (functions) common to all Java Objects of a certain kind.
An object in object oriented programming is a specimen of a class. Software objects are often used to
model real-world objects you find in everyday life.
Q. What is a token?
Q. What is a destructor?
Page 2 of 4