Java keywords and reserved word __java

Source: Internet
Author: User
Tags goto reserved volatile java keywords

Original address: Java keywords and reserved words


1 names cannot be reserved words or keywords, but they are not reserved words or keywords If there are uppercase letters in reserved words or keywords.

2 The opening characters can be in letters, $ or _

3 names can not be used +,-space and other characters

4 parts of the easy to mix reserved word keywords and non-reserved word keywords

NULL, native, Goto,const,instanceof,default is a keyword reserved word
Then,sizeof,main,boolean,unsigned,java, integer is not a keyword reserved word

Note: Because unsigned is not a keyword in java. So there is no such wording in Java: unsigned int a=1; A compilation error is displayed.


All the keywords and reserved words in Java are as follows:

Abstract |   Continue |    for |   New | Switch
assert*** |   Default |   goto* |   Package | Synchronized
Boolean |   do |   If |   Private | This
Break |   Double |   Implements |   protected | Throw
byte |   else |   Import | Public throws
Case |   enum**** |   instanceof |   return | Transient
Catch |   Extends |   int |   Short | Try
char |   Final |   interface |   static | void
Class |   Finally |   Long |   strictfp** | Volatile
const* |   float |   Native |   Super | While


* Not used
* * Added in 1.2
Added in 1.4
Added in 5.0

Ture and False are reserved words. It seems not, but it should not be used.

native: Only for methods, including static methods. Java classes accomplish certain functions and access certain hardware by using a method declared as native. For example, the thread's start () on multithreaded programming invokes the private native void Start0 () method. The disadvantage of Java is that the speed is not as high as C + +, the second is not directly operating system bottom. The native method is equivalent to Java programs and C programs, extending the functionality of Java. Specific See:

Getting Started with Java--understanding the native method in Java: http://www.enet.com.cn/article/2007/1029/A20071029886398.shtml.

Expand Reading Jni:http://baike.baidu.com/view/1272329.htm

Transient: can only be applied to a member variable of a class and cannot be applied to a function's local variables. Variables declared as transient are not serialized by objects and can be used to protect security information.

Synchronized: Used in multiple threads.

Volatile: Can be used for variables and also for constants. A variable declared as volatile can be modified by a thread and can be accessed by multiple threads running. Final: Use final decoration on the base type variable to indicate that the variable can only be initialized once, and the value can no longer be modified. In the final modification of an object variable, it is not possible to modify the object's contents, but the object's reference can only point to the address of the object in the heap. Final person P1 = The new person (); instead of being able to modify the P1 object, P1 cannot point to other objects (P1 = p2 error). The final modification of a method means that the method cannot be overridden (that is, it cannot be overridden by a quilt method, and the subclass nature inherits the parent-class non-private method). Final modifier A class means that the class cannot be inherited. The simple difference between final, finally, and finalize: http://wenku.baidu.com/view/2d4593d0ce2f0066f533224a.html
Java keyword final, Static Usage Summary: http://java.chinaitlab.com/base/724785.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.