why might u define a method native? 1. to get to access h/w that java does not know about 2. to define a new datatype like unsigned integer 3. to write optimised code for performance in a language such as c/c++--true 4 to overcome the limitation of the pvt scope of amethod
If you wanna know more about native methods, here you go (Please note that it is not needed for SCJP exam) In Java, it is possible to call a C/C++ program from a Java program and a Java program from C/C++ program. The first job can be done by declaring the Java method as native and give the implementation in C/C++. To call a Java program from C/C++ program, you got to instantiate the 'Java Virtual Machine' and it can do all the things for you. The Invocation API has number of methods for interaction between the two programs.
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop