Meaningless Drivel is fun!
The moose likes Beginning Java and the fly likes Initilization Block : Why my code goes in loop in initilization block ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Initilization Block : Why my code goes in loop in initilization block ?" Watch "Initilization Block : Why my code goes in loop in initilization block ?" New topic
Author

Initilization Block : Why my code goes in loop in initilization block ?

ashwin bhawsar
Ranch Hand

Joined: Mar 16, 2011
Posts: 62

Why the code goes into loop at line 3 ?

Paul Clapham
Sheriff

Joined: Oct 14, 2005
Posts: 19680
    
  10

The initialization block creates a new SampleClass object.

This causes SampleClass's initialization block to run.

The initialization block creates a new SampleClass object.

This causes SampleClass's initialization block to run.

The initialization block creates a new SampleClass object.

This causes SampleClass's initialization block to run.

The initialization block creates a new SampleClass object.

This causes SampleClass's initialization block to run.

The initialization block creates a new SampleClass object.

This causes SampleClass's initialization block to run.

The initialization block creates a new SampleClass object.

This causes SampleClass's initialization block to run.

... do I need to continue?
ashwin bhawsar
Ranch Hand

Joined: Mar 16, 2011
Posts: 62

ya, i figured it out . Thanks.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Initilization Block : Why my code goes in loop in initilization block ?
 
It's not a secret anymore!