Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java Floating body

 
Dhanushanth Dhanu
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 607
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic