The order in which constructors will be called?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/code-flow.club/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
2 views
In what order will the constructors are called when object will be created of a class ? And destructors when an object is deleted?
interface professor {}; interface researcher extends professor {}; class professor implements teacher {}; class myprofessor extends teacher implements researcher {};

Does the PLO have forgotten. Help answer the question please.
by | 2 views

3 Answers

0 like 0 dislike
Actually it is not Java
And the order of inheritance like this: class constructor, then the constructor of the super class.
Destructors at all
Constructors in interfaces no
\r
Read here:
\rwww.javaworld.com/javaworld/jw-11-2001/jw-1102-java101.html
\rwww.artima.com/designtechniques/initializationP.html
by
0 like 0 dislike
interface professor {}; <- it is not Java (prompt: semicolon...)
\r
And in fact the question is: where have you found in Java destructors? (about the finalize() it is not, that is completely different)
by
0 like 0 dislike
Questions when applying for a job specifically can be built illogical that the candidate will be able to point out the "trick"
by

Related questions

0 like 0 dislike
2 answers
0 like 0 dislike
7 answers
0 like 0 dislike
3 answers
asked May 23, 2019 by Morningstar_T
110,608 questions
257,186 answers
0 comments
24,709 users