Static keywords, which must be learned by java, are hard to understand when many friends write and read code. The following describes how to learn static keywords.
I. static keywords
The original member variables in a class, each new object,
One, static key word
The original member variable in a class, each new object, this object has a member variable of its own, because these member variables are not static member variables. For a static member variable, this member variable has
1 Static member variablesvariables defined in a class are often referred to as member variables if the modifier is added to the front of a member variable Static , then we call this member variable a static member variable. 1.1 methods
Static is a common keyword in C + + that is used to control how variables are stored and visible.In a class definition, its members, including data members and member functions, can be declared as static members with the keyword static. The
The order of Java class initialization is often confusing, and now this article tries to give the JVM an explanation by experimenting with the initialization order of classes in the Java non-inheritance and inheritance relationships from the JVM's
C ++ Primer study note _ 23 _ class and data abstraction (9) -- four object lifetime and scope, static usage summary, primer_23
C ++ Primer study note _ 23 _ class and data abstraction (9) -- four object lifetime and scope, static usage
A function that is described in the class body is called a member function as a member of a class. A general member function, which is defined according to the needs of a certain kind of function. In addition, some special member functions are
Java internal class, Java
Package innerclass; // in Java, a class can be defined in another class or method. Such a class is called an internal class. In a broad sense, internal classes generally include the following four types: member Internal
Static
A static data type is used to create a permanent storage space for a variable. The statically variable keeps their values unchanged when invoked between functions. When used in a class, all the variables that are used in a static variable
First, static global variablesBefore you understand the static keyword, first review the in-memory allocations for C + + programs. from low address to high address is divided into: Code area, global data area, heap area, stack area. global variables
DAY07:1. If local variables and global variables have the same data type and variable names, first call local variables to implement the nearest principle;2. The anonymous object is usually called only once for reasons of limitation, and is only
PackageInnerclass;//In Java, a class can be defined inside another class or inside a method, and such a class is called an inner class. The broad sense of internal classes generally includes these four types: member inner class, local inner class,
Source: Click to open the link
The order of Java class initialization is often confusing, and now this article tries to give the JVM an explanation by experimenting with the initialization order of classes in the Java non-inheritance and inheritance
The static of C + + has two usages: static in process-oriented programming and static in object-oriented programming. The former applies to ordinary variables and functions, and does not involve classes; the latter mainly describes the role of
Scope: Range of valid variable namesExistence: A period in which a variable is present in a program.Storage mode: auto, register, extern, staticStorage type: Stacks (stack): variables that are automatically allocated and purged. Such as: local
Original blog, reprint please indicate the source--Zhou Xuewei http://www.cnblogs.com/zxouxuewei/Static is used in two ways: static in process-oriented programming and static in object-oriented programming. The former applies to ordinary variables
The Static keyword in C1. Static local VariablesStatic local variables belong to static storage, which has the following characteristics:(1) A static local variable defines its lifetime as the entire program life cycle within a function, but its
1. Static in process-oriented design1.1 Static global variablesThe variable is defined as a static global variable before the global variable, plus the keyword static. Let's first give an example of a static global variable, as follows:
Copy
Static is also the keyword we use frequently, and there are many uses for static, and static has different meanings in process-oriented and object-oriented programming. Before always remember, so, I obsessive-compulsive disorder again attack, must
There are two ways to use static: process-orientedProgramStatic in design and static in object-oriented programming. The former applies to common variables andFunction, which does not involve classes. The latter mainly describes the role of static
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.