1. What is the purpose of Void class?
The Void class is an uninstantiable placeholder class to hold a reference to the Class object representing the primitive Java type void.

2. Define an interface.
Interface in java is core part of Java programming language and one of the way to achieve abstraction in Java along with the abstract class.

3. What is the need for an interface?
The main use is the polymorphism, or the ability to perform the same operation on a number of different objects. If different objects all implement the same interface and have the same method, you can store all of those objects in a Vector, for example, and iterate
through the Vector calling that method on each one.

4. What is object cloning?
Cloning means creating a copy of the object. The precise meaning of "copy" may depend on the class of the object. The general intent is that for any object x, the expression:
x.clone() != x

5. How will you create an instance of Class?
There are two reflective methods for creating instances of classes:
• java.lang.reflect.Constructor.newInstance()
• Class.newInstance().

Mukesh Rajput

Mukesh Rajput

I am a Computer Engineer, a small amount of the programming tips as it’s my hobby, I love to travel and meet people so little about travel, a fashion lover and love to eat food, I am investing a good time to keep the body fit so little about fitness also..

Post A Comment:

0 comments: