static keyword for Java
In Java, the static-decorated member variables and member methods are called static variables and static methods, and are not dependent on class-specific instances and are shared by all instances of the class.
static methods and variables can be accessed directly by the class name;
In Java, the static class method and the class variable exist before the instance (object) and can be accessed directly with the class name without initializing the class. The Java virtual machine finds a static method in the method area of the Run-time data area, based on the class name, when the class is loaded.
static variables (also known as class variables) and instance variables, the difference is:
Static variables have only one copy in memory (save memory), the JVM allocates only one memory, completes the memory allocation of static variables in the process of loading classes, accesses directly with the class name, and can be accessed by object (not recommended, as far as possible). An instance
variable allocates memory for that instance when the latter instance is initialized, and the instance variable between multiple instances is independent
A non-static method can call the static method
An instantiated method that can refer to the static method through the object itself
static method cannot invoke Non-static members
However, static methods cannot invoke Non-static methods and reference non-static member variables. Because the class is uninitialized, there are no instances, no memory allocated, cannot be invoked.
This is not available in the static method
You cannot use this to access an object in the static method. The this pointer is a reference to the class object itself and requires the class to initialize the class object before it can be used, that is, the new ClassA () before allocating memory.
if the static function must use some class members when designing a class, the member must also be defined as static. (Memory is required to consider the adequacy of memory)
So, the Java class Main method must be public static
The main method of the class can be accessed directly from the outside, which can be accessed without initialization. Also, non-static members of a class cannot be accessed by uninitialized class objects.
class is not instantiated (initializing new ()), you need to access the class intrinsic functions, using the Java reflection mechanismhttp://blog.csdn.net/longshenlmj/article/details/10076187 http://blog.csdn.net/longshenlmj/article/details/13295717
final keyword in Java
The class of 1.final is not allowed to be inherited.
2.final method is not allowed to be overwritten. A
3.final variable can only be assigned one value at a time.
Number of judgements: if (! parentregionid.matches ("\d+"))
Judgment string: if (! parentregionid.matches ("\w+"))
\ Escape
^ Opening