"A native method is a Java method whose implementation is provided by non-java code."
在定义一个native method时,并不提供实现体(有些像定义一个java interface),因为其实现体是由非java语言在外面实现的:
public class Shuzu {
public final static native int w();
public static void main(String[] args) {
int m, n;
int ms[] = new int[n];
Shuzu sz = new Shuzu(100);
n=1;
System.out.println(ms.length);
n = 1;
}
public int add(int a, int b) {
return a + b;
}
public Shuzu(int n) {
int[] ms = new int[n];
System.out.println(ms.length);
}
}