Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

what does this "static" mean

Status
Not open for further replies.

fechen

Technical User
Jan 25, 2002
48
US
I am reading Java tutorial on JNI and saw this static statement. Can anyone shed me some light?

static { System.loadLibrary("hello"); }

Thank a lot,

==================================================
class HelloWorld {
public native void displayHelloWorld();

static {
System.loadLibrary("hello");
}

public static void main(String[] args) {
new HelloWorld().displayHelloWorld();
}
}

 
The "static" keyword insures that the block of code only executes once per process. It further ensures that the timing of the execution will be prior to any non-static code executes.

-pete
 
palbano,

I saw the tutorial called it "Static Initializer". That matches your explanation. I searched the web, didn't find more details. Do you know any web pages regarding to this topic?

Thanks,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top