• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

output of this program?

 
Anto Telvin
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all
i have a code like this .

[edit]Add code tags and improved indentation. CR[/edit]
[ October 08, 2008: Message edited by: Campbell Ritchie ]
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The instance initializer is executed every time an instance of the class is created, much like a Constructor, but before the Constructor gets called and you don't have to explicitly call it, it automatically gets called by the JVM.
 
Anto Telvin
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you very much
 
ram kumar
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Anto telvin Mathew:
thank you very much


FYI - this is the sequence of execution !

Probably, this would be informative additionally !




Ouput !

Static intializer Block
Hi from main method
Initializer Block
Constructor Block


[edit]Additional newline in long line. CR[/edit]
[ October 08, 2008: Message edited by: Campbell Ritchie ]
 
Campbell Ritchie
Sheriff
Pie
Posts: 49813
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can I remind ranchers, please, to maintain indentation with code tags; I have added them to the original post and Ram Kumar has given a very good example of their use. Both these code examples show how much easier it is to read.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic