Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Static in a class

  Asked By: Vernon    Date: Sep 06    Category: Java    Views: 556
  

I have seen this source code, can somebody explain me when the code inside
the static{} is executed?

public class MyClass extends BaseComponent {

static
{
System.out.println("Call MyClass::static");
}
public MyClass ()
{

}
}

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Edward Jones     Answered On: Sep 06

At the time of class  initialization. Normally JNI libs are loaded like
this

 
Answer #2    Answered By: Lewis Welch     Answered On: Sep 06

in short - static  parts will be executed before ANY OTHER part of the
class is executed

 
Didn't find what you were looking for? Find more on Static in a class Or get search suggestion and latest updates.




Tagged: