Rated 100% Correct 2025!!!
1. Public,
Private: only the class in which it is declared can see it; Protected: can
private,
only be seen and used by the package in which it was declared and can
protected be seen by subclasses or package members; Public: Everyone can see it
For, while, if
2. Different types
of loops
Inheritance is a mechanism in which one object acquires all the
3. What is properties and behavior of another object of another class. It
inheri- represents IS-A relationship. It is used for Code Reusability and
tance? Method Overriding.
A reference variable that is used to refer parent class objects. Used
4. What does in derived classes. Used to call parent methods. Used to access
super mean? parent class constructor.
5. What does variable or function is shared between all instances of that class.
static mean? Belongs to the type, not the actual objects themselves
6. What is an anony- An anonymous class is a local class without a name. It is defined
and instantiated
mous class? Why a single succinct expression using the 'new' operator. Since an anonymous
can't we write class has no name it's not possible to write a constructor. We must
a constructor for instead use a local class or an instance initializer.
an anonymous
class?
7. How to writepublic class X implements YInterface
a class that
imple- ments
an inter- face
8. What is a set? A set is a standard generic data type that uses an array data
1/
7
, Data Structures and Algorithms in Java Questions & Answers
Rated 100% Correct 2025!!!
structure. Collection extends set.
9.
2/
7