1.

What would be the behaviour if this() and super() used in a method?(a) Runtime error(b) Throws exception(c) compile time error(d) Runs successfullyThe question was posed to me during a job interview.This is a very interesting question from Constructor in portion Classes and Methods of Java

Answer» RIGHT answer is (C) COMPILE time error

The EXPLANATION: this() and super() cannot be USED in a method. This throws compile time error.


Discussion

No Comment Found

Related InterviewSolutions