What is the native keyword in Java for?

后端 未结 10 1544
粉色の甜心
粉色の甜心 2020-11-22 10:52

While playing this puzzle (It\'s a Java keyword trivia game), I came across the native keyword.

What is the native keyword in Java used for?

10条回答
  •  眼角桃花
    2020-11-22 11:37

    Straight from the Java Language Specification:

    A method that is native is implemented in platform-dependent code, typically written in another programming language such as C, C++, FORTRAN,or assembly language. The body of a native method is given as a semicolon only, indicating that the implementation is omitted, instead of a block.

提交回复
热议问题