java.lang.object RegisterNative implementation and static block -
in object.class file in jdk 7 see next snippet
public class object { private static native void registernatives(); static { registernatives(); } two questions:
ok actual implementation of method? method has no body. the method set static. why static block needed 1 time again right below it?
this method declaration
private static native void registernatives(); doesn't provide body. it's similar interface methods
public interface whatever { public void somemethod(); } the method isn't abstract, implementation deferred native code. note method declaration. hasn't been invoked.
to invoke it, object declares static initializer block. executed when class loaded. object 1 of scheme classes , among first classes loaded jvm.
finding native code depends on jre implementation. where find source code java.lang native methods?
java object static
No comments:
Post a Comment