*
The moose likes Beginning Java and the fly likes output of this program? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "output of this program?" Watch "output of this program?" New topic
Author

output of this program?

Anto Telvin
Ranch Hand

Joined: Aug 12, 2008
Posts: 113
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 ]

Anto Telvin Mathew<br />Many of the life failures are people who did not realize how close they were to success when they give up. EDISON
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4165
    
  21

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.


Steve
Anto Telvin
Ranch Hand

Joined: Aug 12, 2008
Posts: 113
thank you very much
ram kumar
Ranch Hand

Joined: May 22, 2008
Posts: 146
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 ]

Discussion - the powerfull way to excellence!
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37950
    
  22
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: output of this program?
 
Similar Threads
Why it gives ERROR without 'this'
Difference between instace initializers and the member initializers
Code confusion
Java Free Blocks
pls help exams are on my head