NDK Interview Question
What is Native Interface in JAVA?
Answer: JNI is the mechanism used to invoke methods written in languages such as c and C++. You can write code using language like c and c++ and declare its native methods and can use the same method in java using JNI.
JNI exposes JNI functions and pointers that can access java objects and methods.
What is Native Interface in JAVA?
Answer: Java Native Interface permits the developers to integrate the native code such as C or C++ into a java application. To take the advantages of C programming and implementing the Java GUI features together makes the applications more efficient and powerful.
JNI is used to handle situations where the entire application can not be written in java.
Explain the advantages and disadvantages of using JNI.
Advantages:
- Use the existing library that was previously written in another languages.
-Use of windows API functions
-Increasing the speed of execution
-Invoke API functions from server product that is developed in C or C++ from a java client.
-Use of windows API functions
-Increasing the speed of execution
-Invoke API functions from server product that is developed in C or C++ from a java client.
-Using JNI, we can access c and c++ code which adds performance boost to JAVA.
-JNI allows JAVA to access some hardware features using other languages like c and c++.
Disadvantages:
-Write Once Run Anywhere is not possible
-Run time errors debugging is difficult in native code
- An applet can not call a native method
- Security risk is potential
-Run time errors debugging is difficult in native code
- An applet can not call a native method
- Security risk is potential
-JNI uses native languages which mean it has portability issue.
-Code debug is big problem for the developers who use JNI features in JAVA.
Reference:
No comments:
Post a Comment