Suppose you have a C function that does something you like and, for one reason or another, you don't want to bother reimplementing it in the Java programming language. For the sake of illustration, we assume it is the useful and venerable printf function. You want to be able to call printf from your programs. The Java programming language uses the keyword native for a native method, and you will obviously need to encapsulate the printf function in a class. So, you might write something like this:
public class Printf { public native String printf(String s); }
You actually can compile this class, but when you go to use it in a program, then the virtual machine will tell you it doesn't know ...
No credit card required