gpt4 book ai didi

java - "AWT widgets written in Java which delegated to peer classes that were written in C"是什么意思?

转载 作者:太空宇宙 更新时间:2023-11-04 01:10:36 27 4
gpt4 key购买 nike

我不明白

的意思

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/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com