gpt4 book ai didi

java - 资格是什么意思?

转载 作者:可可西里 更新时间:2023-11-01 18:20:14 26 4
gpt4 key购买 nike

在阅读有关编程的文章、手册等时,我总是会遇到 qualified 这个词。就像在 java 中一样,完全限定的类名将是 com.example.Class。阅读 this文章,将 C++ 中的范围解析运算符 :: 定义为用于限定隐藏名称,以便您仍然可以使用它们。这有定义吗?因为它似乎每次都在不同的上下文中使用。

最佳答案

In computer programming, a fully qualified name is an unambiguous name that specifies which object, function, or variable a call refers to without regard to the context of the call. In a hierarchical structure, a name is fully qualified when it "is complete in the sense that it includes (a) all names in the hierarchic sequence above the given element and (b) the name of the given element itself." Thus fully qualified names explicitly refer to namespaces that would otherwise be implicit because of the scope of the call. While always done to eliminate ambiguity, this can mean different things dependent on context.

Source Wikipedia

简而言之,它的意思是,

您可以在您的项目中有一个名为 Math 的类,但是 Math 也已经存在于 Java 中。

因此,为了明确识别您实际指的是哪个类,您还需要使用包来限定名称:

java.lang.Math //refers to java class Math
org.myproject.Math //refers to your project Math class

关于java - 资格是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18803036/

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