Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

output of this program?

 
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you very much
 
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Marshal
Posts: 74684
335
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic