我不明白
的意思The original Java AWT was implemented by having widgets written in Java which delegated to peer classes that were written in C
“用 C 编写的对等类” 部分:
这意味着 Java 类包含 native 代码?
最佳答案
Hotspot Java 有相当一部分运行时系统是用 C/C++ 编写的。有一次,这包括 AWT 对等类。 (而且它仍然可以......)
native 代码不在 Java 中。相反,Java 通常具有 native
方法声明,这些方法声明通常在加载相应的 native 库时绑定(bind)到 native 实现。
(但不要将此视为绿灯,在您的代码中做同样的事情。与 native 代码交互是棘手的,如果您弄错了,您可能会触发严重的 JVM 崩溃......痛……)
关于java - "AWT widgets written in Java which delegated to peer classes that were written in C"是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13171908/