Friday, March 28, 2014

No function name followed by static


public class Nadd {
static {

System.loadLibrary ("Nadd");

}


public native int nadd (int a, int b);
}

There should be followed by a feeling of static function name, ah, why not have it here?
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
You can not, this is generally called static block.
static class initialization block is executed
Reply:
static block is run before the class constructor Nadd
Reply:
This is a detail of the Java syntax.
Class initialization, class static variable, the statement block will be executed sequentially, after the constructor is class.

No comments:

Post a Comment