D
D
darzet2010-09-29 17:27:43
Java
darzet, 2010-09-29 17:27:43

In what order will the constructors be called?

In what order will constructors be called when an object of the class is created? What about destructors when deleting an object?

interface professor {};
interface researcher extends professor {};
class teacher implements professor {};
class myprofessor extends teacher implements researcher {};

I completely forgot OOP. Please help answer the question.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
J
javax, 2010-10-03
@javax

Actually, this is not Java
. And the order of inheritance is this: the class constructor, then the super class constructor.
There are no destructors at all No
constructors in interfaces
Read here:
www.javaworld.com/javaworld/jw-11-2001/jw-1102-java101.html
www.artima.com/designtechniques/initializationP.html

G
Gribozavr, 2010-09-29
@gribozavr

interface professor {}; <-- this is not Java (I suggest: a semicolon ...)
But in essence the question is: where did you find destructors in Java? (we are not talking about finalize(), this is completely different)

S
Sheh, 2010-09-30
@Sheh

Job hiring questions can be deliberately structured illogically so that the candidate can point out the “trick”

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question