我被要求“识别 Java 中的所有语言结构。您的列表应以类开头:
类声明的主体"
我的印象是“语言结构”是一种语言中任何允许的命令,但这显然不是问题的意思。如果有人能让我更清楚地了解这种情况下的语言结构是什么,以及这个列表应该包含什么样的东西,我将不胜感激。
提前致谢!
我被要求“识别 Java 中的所有语言结构。您的列表应以类开头:
类声明的主体"
我的印象是“语言结构”是一种语言中任何允许的命令,但这显然不是问题的意思。如果有人能让我更清楚地了解这种情况下的语言结构是什么,以及这个列表应该包含什么样的东西,我将不胜感激。
提前致谢!
Well, according to Wikipedia, a language construct is "a syntactically allowable part of a program that may be formed from one or more lexical tokens in accordance with the rules of a programming language"
The phrase "language construct(s)" appears in the JLS once, in the Preface (excluding a mention in the index): "We intend that the behavior of every language construct is specified here..." This implies that every Java "language construct" is cataloged in the JLS. Combined with the Wikipedia definition, that would seem to cover everything from keywords and literal values; types, names, and variables; to packages, classes, interfaces, and class members like methods, fields, and constructors; blocks, statements, expressions... Take your pick. Just take a look through the ToC.
在我看来,他的意思是问“在类声明的主体中允许什么?” 在普通的 Java 中,会是这样的:
我希望你会知道什么是构造。
因此,让我告诉您 Java 中允许的构造类型:
这种分类是基于执行代码时编译器或解释器所遵循的路径。
希望能帮助到你。