O'Reilly logo

PURE Java™ 2 by Kenneth Litwak

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Other Modifiers

A number of other modifiers are useful in defining methods. You can specify that a method should synchronize its resources, or that the method is for a native code implementation. These options are discussed next.

Native

Declaring a method as native means that you are giving the signature for a method that will be actually coded in another language, such as C. You can then call this code from a Java method. This feature is called the Java Native Interface, or JNI. This is a big topic that whole books cover, so this section will just point you to the basics.

Caution

This topic has a lot of potential "gotchas," so I recommend it only for experienced Java programmers.

Native methods are used when you really need to accomplish something ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required