Describe the use of “instanceof” keyword.

Describe the use of "instanceof" keyword.

- The "instanceof" operator is used to test if the object is an instance of the specified type (class or subclass or interface).
- It is also known as a type comparison operator as it compares instance with type.
- It may either return true or false.
- If it is applied with any variable which has null value ten it returns false.

What is the purpose of "this" keyword?

- "this" keyword is used to refer current instance of object.

Some of the uses of "this" keyword are:

1. It can be used to refer current class instance variable.
2. It can be used to invoke current class constructor.
3. It can be used to invoke current class method (implicitly)
4. They can be passed as an argument in the method call.
5. They are passed as argument in the constructor call.
6. They can also be used to return the current class instance.
Disadvantage of garbage collector
What is the disadvantage of garbage collector? - Although garbage collector runs in its own thread, still it has impact on performance. It adds overheads....
What is an Applet?
What is an Applet? - An applet is a small server side application that can be loaded and controlled on the browser by the client..
Explain the life cycle of an applet.
Explain the life cycle of an applet. - Below are sequences of methods that describes the life cycle of an applet.....
Post your comment