Based on articles: the basic composition of the Java language
Java language mainly composed of the following five elements: identifiers, keywords, text, the operator and separation. These five elements have a different meaning and composition of the rules of grammar, they complement each other, have completed the Java language semantic expression. Below we were to be on.
1: identifier
Variables, classes and methods will need the name, we will be called this name identifiers. Java identifiers in a certain restrictions. First: all the characters in the first identifier must be letters (upper and lower case), underscore _ or dollars at ï¿¥ Secondly address is marked by numbers (0 - 9), all from A - Z in capital letters, a — z of the lowercase letters and underlined _ the dollar at all ï¿¥ and hexadecimal 0 xc0 before the ASCII code, etc.; third at the attention that the reservation system can not be used to do keyword identifiers.
These are the basic rules for naming identifier, the following is a comparison table is wrong, it will identifier through the naming rules have a better understanding of:
Legitimate identifier illegal identifier
Try try # (Note: # can not be used as identifiers)
Group_7 7group (Note: The figures can not be used beginning symbol)
Opendoor open-door (Note: You can not use - as a symbol marking)
Boolean_1 boolean (Note: boolean for keywords, and we can not do keyword identifiers)
2: Keyword
Keyword itself is the use of the Java language identifier, it has its specific grammatical meaning. All Java keyword will not be used as identifiers, Java keywords:
Abstract, continue, for, new, switch, boolean, default, goto, null, synchronized, break, do, if, package, this, byte, double, implements, private, threadsafe, byvalue, else, import, protected, throw, case, extends, instanceof, public, transient, catch, false, int return, true, char, and final, interface, short, try, class, and finally, the long, static, void, const, float, native, super, while such.
3: Data Types
Java have different data types, Java data types: integer, floating-point type, Boolean, character, string type.
Integer data is the most common type of data, its manifestations are: decimal, hexadecimal, and octal. Hexadecimal integer 0 X must be a beginning.
Each occupies a 32-bit integer data storage space, or four bytes. This means that the integer data, the range of between -2147483648 and 2147483648, if for some reason, you must make a greater number of 64-bit long integers should be enough. If you want an integer as a mandatory deposit-long (long), you can figure behind by the letters l.
Floating-point data used to represent a minority with a decimal number. For example, 1.35 or 2.36. Float is the standard form, but also can be used in the form of scientific counting method, the following are some examples:
3.1415926 0.34 .86 .01234 9.999E8
Float called standard single precision floating point, and its storage space for 32, which is four bytes. Also have 64 double-precision floating point. You can use the D suffix sure you want to use this double precision floating point.
Boolean type is the simplest type of data types, Boolean data only two states: true and false, usually keyword true and false to state that these two.
Character data from a single quotation marks enclose a single character. It can be on the arbitrary character of a character, such as: 'a', 'b'.
With a string data type is a double quotation marks enclose the character sequence, a string of data from the String class is actually achieved by (the concept of the follow-up section, we will explain in detail), rather than in the C language used by the number of characters group. A string of data will produce a new type String example, readers do not have this type of string with the concept of relationship are worried that, because of the characteristics, you do not have to worry about how to achieve them, they will take good care of their own, It should be stated that in Java, as a string of only stems from security considerations.
Below are a few examples of string
"How are your"
"I am Student
4: Operators
Any language has its own operator, the Java language is no exception, as are all +,-,*,/ operator, the operator's role is certain computing and data components to complete expression of the corresponding operation. On the different types of data, have different operators.
5: separation
Separators used to confirmation code compiler where segregation. ''''';'':' Are separated at the Java language.
Editor: Li (lisz@staff.ccidnet.com)
Tags: basic, java language, java programming language






