Learn and understand

1. Understanding of domains

Today, look at the Java core technology volume 1, saw the domain feel a little hard to understand, then on the Internet to find relevant content found field is the domain of original English word, can conveniently translation for the domain, but for me to sprout new domain too obscure, the word is difficult to understand (of new refers to himself), With comparison of commonly used words can further understand the domain as properties, fields, and variable, and so on, so a bit broad, said the domain is not only the fields in the Java language, if you want to farm (create methods, properties, etc.), you must first have a field (domain) and then assign you your own fields, waiting for you to be times when you can use the block of land, so say, Field use it another meaning of the word instead more easy to understand, is refers to static field when creating methods and properties you give corresponding methods and properties of the allocated memory space, and wait for you in the class need to use these methods and properties you can invoke the memory address values for related calls (right) and I don’t know understand

2. The final keyword

The final keyword is relatively easy to understand, because when final modifies a class, it indicates that the class cannot be changed (the leaf class in the inheritance tree); When final decorates a method, it indicates that the method cannot be overridden, but can be used in subclasses that inherit the class. When a final modifies a property, its value cannot be changed after the property is initialized. Its initialization can be done in two places: one is its definition, that is, it is directly assigned when the final property is defined; The second is in the constructor. You can either assign a value at definition time or in the constructor. You cannot assign a value at definition time and a value in the constructor at the same time.

Static fields, static constants, and static methods

Static field is easy to understand, that is, open the memory space together, there is only one such space in each class, in the latter method invokes the static field, put the content in the memory space, static fields belong to the class, do not belong to any object, the object can’t call it, only by class called static constants, when we by modifying an attribute using the static, In our subsequent calls, we don’t need to create an object to call this property, we can just use the class. Property to obtain the value of the property static method, static method and static constant use is similar, can only be directly called by the class, not the reference object to call the method, static domain cannot access the instance domain, but can access its own static domain. Static methods are used in two cases: 1. A method does not need access to object state, and the required parameters are provided by display parameters (e.g. Math.pow). 2. A method only needs to access the static field of the class (e.g. Student,getNextid()). The most common static method is main: public static void main(String[] args){}.

Summary:

A thorough understanding of memory is important for learning JAVA, and most calls are to the memory address of the call, not to the memory space directly called or changed