Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

initialization sequence  RSS feed

 
geeta rai
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could someone pls enlighten on the sequence of initialization steps when we have initializer blocks(both static and instance), superclass and subclass constructors in consideration.
Thanks.
 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I hope the following link might help you, which I bookmarked long time ago, when I was on my way to SCJP 1.2....
http://www.artima.com/objectsandjava/webuscript/InitCleanup1.html
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
geeta,
When I'm curious about things of this nature, I like to write myself a quick example program to see just what happens.
Concerning your curiousity, the following example
Foo

MiniBar

Bar

produces the following output.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!