Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the basic words of java

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces the basic vocabulary of java, which has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, let the editor take you to understand it.

2.6.1 White space delimiter (whitespace)

Java is a free-form language. This means that you don't have to follow any special indentation rules. For example, all the code for the example program can be on one line, or you can enter the program code in any way you like, as long as at least one blank separator is left between tags that have been described by operators or delimiters. In Java, the white space delimiter can be a space, a Tab tab, or a line feed.

2.6.2 Identifier (identifiers)

An identifier is the name assigned to a class, method, or variable. An identifier can be any combination of uppercase and lowercase letters, numbers, underscores, and dollar signs, but cannot start with a number. Otherwise, it is easy to be confused with numbers and constants. Again, Java is case-sensitive, and VALUE and Value are two different identifiers. Here are some valid identifiers:

AvgTemp count A4 $test this_is_ok

Here are some invalid variable names:

2count high-temp Not/ok

2.6.3 constant (literal)

In Java, constants are represented by literal. For example, here are some constants:

100 98.6'X' "This is a test"

From left to right, the first represents an integer, the second is a floating-point value, the third is a character constant, and finally a string. A constant can be used anywhere by the type it allows, representing a value of the type to which it belongs.

2.6.4 comments (comments)

Java defines three types of annotations. There are two types of comments you already know: single-line comments and multi-line comments. The third type of documentation comment is called a document comment. Such comments make comments for your program in the form of a HTML file. Documentation comments begin with "/ *" and end with "* /". The documentation comments are explained in Appendix A.

2.6.5 Delimiter (separators)

In Java, some characters are used as delimiters, and the most common delimiter is the semicolon (;), which separates statements. The following are common delimiters.

Symbol name usage

() parentheses are used to hold parameter tables when defining and calling methods. In a control statement or cast composition

Used to indicate the priority of execution or calculation in the expression of

{} curly braces and curly braces are used to include the values of the automatically initialized array. Also used to define blocks, classes, methods, and offices

Departmental scope

[] square brackets and square brackets are used to declare the type of the array and to unreference the value of the array

Semicolons are used to terminate a statement

A comma is used in the variable declaration to separate the variables in the variable table In the for control statement, used to

Join the statements in parentheses

. Periods (dots) are used to separate the name of a package from its subpackages or classes. It is also used to combine reference variables with variables or

Method separation

2.6.6 Java keyword

The Java language currently defines a total of 48 reserved keywords (see Table 2-1). These keywords, along with the syntax of operators and delimiters, form the definition of the Java language. These keywords cannot be used for variable names, class names, or method names.

The keywords const and goto are retained but not used. In the early days of the Java language, several other keywords were reserved for later use. But the keywords currently defined by Java are shown in Table 2-1.

In addition to the above keywords, Java has the following reserved words: true,false,null. These words are values defined by Java. You can't use these words as variable names, class names, and so on.

Thank you for reading this article carefully. I hope the article "what are the basic words of java" shared by the editor will be helpful to you. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report