File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes java Floating body Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "java Floating body" Watch "java Floating body" New topic
Author

java Floating body

Dhanushanth Dhanu
Greenhorn

Joined: Jul 10, 2010
Posts: 16
hi guys i have a dought according the below coding ............


here the answer is :"Printing first one"


but if we instance like above it prints :"Printing first one" & "printing second one".
i'm asking is what is happening when we instance that ...i need full explanation
Saifuddin Merchant
Ranch Hand

Joined: Feb 08, 2009
Posts: 597

The rule here is Show Some Effort.

Well tell us what you think is happening.
Do you know what a the static block does? Do you know what the block -- {System.out.println("printing second one");} is called?

Hint: The first piece of code is different from the second. Whats the difference? Here is a third code snippet to try. Try it out and let us know what you think?



Cheers - Sam.
Twisters - The new age Java Quiz || My Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java Floating body
 
Similar Threads
Question on scope
primitive value
What is the output for First Snippet and Second Snippet?
Tell me Why ?
initialisation and reinitialisation doubt.....