Package com.fish.object;/*static (static, modifier) static modifier member variable: When static modifies a member variable, the data for that member variable is a shared data. How static member variables are accessed: mode one: Access by using
Beginner Java, in the face of this static modifier, Leng two days of time, still pondering today, now will realize the things recorded:1, the static modifier, the content (variables, methods, blocks of code that have been temporarily learned about
classperson{PrivateString name; Private intAge ; /** Assuming the nationality of each person object is the same, it would be unreasonable to assign a value to each call. * With static modification, nationality is first established, and each
Let's talk about static.
1.static decorated domain, we call the static domain, which is classified all, is shared by all objects, and only one2.static decorated chunks, the field is only initialized once3.static a field or method that can be
Any variable or code in the program is automatically allocated by the system at compile time to store the memory, and so-called static refers to the memory allocated after compilation will persist until the program exits the memory to release the
First understand the difference between static variables, declare a function test ()function num () { $a = 0; Echo $a ; $a+ +;} num (); num (); Num (); // Outputfunction num () { static$a = 0; Echo $a ; $a+ +;} num (); num ();
(1) Modifying local variablesChange the storage type and drop it into the static zone (modifiable)Stack zone to static zone (static zone open variables, the program is destroyed after the end of the range can not be used, but in the static
The C program has been composed of the following parts:1) The machine instruction part that the body section--CPU executes; a program has only one copy; read-only to prevent the program from modifying its own instructions due to an accident;2)
Simple code Summary, the shortcomings of a lot of advice.//Simple to use-(void) blockone{intNumber= at; int(^blockone) (int) = ^(intnum2) { returnnumber*num2; }; NSLog (@"block%d for output", Blockone (2)); }-(void)
Static modifier internal class
Create content classes by using instance objects of external classes
Public class AA {int a = 1; class BB {int B = 3;} public static void main (String [] args) {AA a = new AA (); BB B =. new BB (); System.
Create content classes by using instance objects of external classes
public class AA { int a =1; class BB { int b=3 ; } public static void main(String[] args) { AA a =new AA(); BB b=a.new BB();
Os:windows7 x64Jdk:jdk-8u131-windows-x64Ide:eclipse Oxygen Release (4.7.0)Code:The outer class Testouter {//inner class can use the static adornment because the inner class is equivalent to a member variable of the outer class static class Testinner
1.staticAny variable or code in the program is automatically allocated by the system at compile time to store the memory, and so-called static refers to the memory allocated after compilation will persist until the program exits the memory to
The static modifier function means that the function is visible only inside the module.
Because in C, the function is external. The function, no matter what file it is written in, is visible in other files.To restrict a function from being visible
Protectedto talk about the protected access rights issue. Look at example 1 below:Test.java
Class MyObject {} public
class Test {public
static void Main (string[] args) {
MyObject obj = new MyObject (); C5/>obj.clone (); Compile
In C, the literal meaning of static is easy to lead us astray, in fact, it has a role of three.The first and most important piece of the article: Hide.When we compile multiple files at the same time, all global variables and functions without a
Copy Code code as follows:
Re-encapsulate the Document object
var console={
Write:function (msg) {alert (msg);}
};
Person Object
var person={
_name: "Zzl",//static public
_age:28,
Printinfo:function () {Console.Write ("Name:
1 /*2 static (statically)3 4 Requirement: Describe the class of the student of wisdom. It's all Chinese ....5 6 7 existing problems: All students are Chinese, there are n students will have n copies of China's data in memory, so that the child8 will
The object class (Class) is the most basic type in a C # type. A class is a data structure that combines states (fields) and behaviors (methods and other function members) in a single unit. class provides a definition for dynamically creating an
Many of the students in the background of the study site are some of the key words of C # can not touch the brain, and now with you to learn the meaning of these keywordsTypeVoidWhen used as the return type of a method, the Void keyword specifies
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.