首页 > 试题广场 >

Why does Java provide the abil

[问答题]
Why does Java provide the ability to call from a Java program native methods that are written in,say,C or C++?Provide an example of a situation in which a native method is useful.
推荐
Java programs are intended to be platform I/O independent.Therefore,the language does not provide access to most specific system resources such as reading from I/O devices or ports.To perform a system I/O specific operation,you must write it in a language that supports such features (such as C or C++.) Keep in mind that a Java program that calls a native method written in another language will no longer be architecture-neutral.
发表于 2018-05-05 21:24:28 回复(0)