Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

instance block is called first or constructior called first in java

 
Ramakrishna Gummadi
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
instance block is called first or constructor is called first in java
 
Sandeep Kumar B
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Instance block
 
Rob Spoor
Sheriff
Pie
Posts: 20532
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which you could have tried yourself by simply implementing it.
 
Ramakrishna Gummadi
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sandeep Kumar B wrote:Instance block

I mean is instance block called first or constructor called first ?

actually i heared dat.. if a instance block and constructor in a class... then while we creating object to that class.. constructor wil called. now before constructor execution, constructor wil call and execute the instance block, then constructor executes... is this right >?
 
Campbell Ritchie
Sheriff
Pie
Posts: 48972
60
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Go through the Java™ Language Specification index and look for "order" with ctrl-F. This is one of the hits, which I hope you will find useful. If not, try again with ctrl-F "order"
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic