Wednesday 28 March 2012

Java interview questions: - Explain Native Interface in JAVA?

JNI is a mechanism by which you can invoke method written in native language like C and C++. Native languages allow you to use a platform specific feature which is not in control of java language. For instance if you want java to interact directly with some specific type of hardware it will extremely difficult to achieve it. So you can write a C code and declare its native methods and call the same in Java.


Figure: - JNI in action


The above figure indicates how JVM interacts with JNI and without. With JNI it has the extra layer of C or C++ DLL i.e. native source code or native methods which interacts with the operating system.

See the following video on Batch Processing in Hibernate: -



Click for more Java interview questions

Regards,

Visit for more author’s blog on Java interview questions

No comments:

Post a Comment