Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

When will it execute

807569Jul 14 2006 — edited Jul 14 2006
I have a small understanding problem in java.
First a small sample cod
public class Foo {
    private static final String test = "abc";
    static{
            //some code to do certain task
           //when does the code here get executed
     }
}
In the above code, when will the block of code inside the static { block will be executed.
Is it a type of constructor or something else?
Thanx in advance for your ideas in clearing my obstacle.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 11 2006
Added on Jul 14 2006
18 comments
183 views