Core Java - Interview Questions and Answers

281. Object class is a superclass of all other classes?

Ans : True

282. Java supports multiple inheritance?

Ans : False

283. What is inheritance?

Ans : Deriving an object from an existing class. In the other words, Inheritance is the process of inheriting all the features from a class

284. What are the advantages of inheritance?

Ans : Reusability of code and accessibility of variables and methods of the superclass by subclasses.

285. Which method is used to call the constructors of the superclass from the subclass?

Ans : super(argument)

286. Which is used to execute any method of the superclass from the subclass?

Ans : super.method-name(arguments)

287. Which methods are used to destroy the objects created by the constructor methods?

Ans : finalize()

288. What are abstract classes?

Ans : Abstract classes are those for which instances can’t be created.

289. What must a class do to implement an interface?

Ans: It must provide all of the methods in the interface and identify the interface in its implements clause.

290. The run() method should necessary exists in clases created as subclass of thread?

Ans : getClass(), notify(), notifyAll(), and wait()

Post a Comment

Mới hơn Cũ hơn