Java Interview Questions & Answers part 5

0
483
Q: – Is it possible to override the main method?

NO, because main is a static method. A static method can't be overridden in Java.

Q: – What is the % operator?

The % operator is the module operator or reminder operator. It returns the reminder of dividing the first operand by second operand.

Q: – What is the use of bin and lib in JDK?

bin contains all tools such as javac, applet viewer, awt tool etc., whereas lib contains all packages and variables

Q: – Which methods in the Object class are declared as final?

getClass()
notify()
notifyAll()
wait()

Q: – Which Java operator is right associatively?

Java support = operator

Q: – What is super?

Super is a keyword which is used to access the method or member variables from the superclass.

Q: – What are the three OOPs principles and define them?

Encapsulation, Inheritance and Polymorphism are the three OOPs Principles.

Q: – Can a byte object be cast to a double value ?

No

Q: – Can we instantiate an interface?

You can’t instantiate an interface directly, but you can instantiate a class that implements an interface.

Submitted By:-Ankur Jain           Email-ID: – ankurjain548@gmail.com

SHARE

LEAVE A REPLY