bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

Learn/Java/Java Reference
Java•Java Reference

Java native Keyword

Flash cards

Review the key moves

1/4
Core idea

What is the main idea behind Java native Keyword?

Lesson checks

Practice each idea before moving on

Short Mimo-style checks built from this lesson's code, terms, and sequence.

1Quick choice

Which statement best captures the main point of this lesson?

2Fill blank

Complete the missing token from the example code.

___ Main {
3Order

Put the learning moves in the order that makes the concept easiest to apply.

Load a method from a compiled library:
Definition and Usage
Java native Keyword

❮ Java Keywords

Example

Load a method from a compiled library:

class Main {
 static {
 System.loadLibrary("libraryname");
 }
 public static void main(String[] args) {
 test();
 }
 private static native void test();
}

Definition and Usage

The native keyword declares a method as belonging to an external compiled library which is native to the operating system.

In order to use native methods, an external library must be loaded from a .dll , .so or similar kind of file. The compiled code in the external file should be written to support the Java Native Interface.

❮ Java Keywords

Previous

Java module Keyword

Next

Java new Keyword