1. Storage of Java data
1) Register: it is on the CPU and cannot be directly controlled
2) stack (the stack): Located in memory, used to store basic types and object references. The processor support can be obtained through the stack pointer, and its speed is second only to the register. The JAVA system needs to know the lifecycle of all items stored in the stack.
3) Heap: the heap is located in the memory and used to store Java objects. It is more flexible and does not need to know the object lifecycle, but it takes more time to allocate and clean the heap.
4) static storage zone: stores static members.
5) store constants: store constants (final) members.
6) Non-ram storage: stores stream objects and persistent objects.
See here: http://zmesky.blog.163.com/blog/static/204247180201222682652635/ is for reference only and not sure it is correct
2. Array
The array is automatically assigned an initial value. For example, if the object is null and the basic type is 0
3. Scope
The scope of a variable is determined by curly brackets. For example
{ int a = 1; // only a available { int b = 2; // both a & b available } // only a available // b is "out of scope" }
4. Default Value of basic type
If the basic type is a member variable of a class, it is assigned a default value of 0 when declared but not initialized. If it is not a member variable of the class, an error occurs when you call the API directly without initialization. For example
class Man { char gender; int age; }Man man = new Man();System.out.println(man.age); // this is correctint a;System.out.println(a); // this would lead to error
5. javadoc
Javadoc is a tool used to generate Java documents. It can generate HTML annotation documents by extracting comments from Java code. Common parameters are as follows:
@ See classname: For details about other classes, the see also field is generated.
@ Version-Info: Add-version when javadoc is used to generate the version field.
@ Author-Info: When javadoc is used, add-author to generate the author field.
@ Since info: generate the since field
@ Param param-name param-Description: It is written on the top of the method to generate the method parameter information.
@ Return Description: writes to the top of the method to generate the method return value.
@ Throws: It is written at the top of the method, and the generated method throws exception information.
Instance code:
/** * Test Class * @author alexis * @author cngddflzw@gmail.com * @version version 1.0 * @see java.util.Date * @since JDK 1.6 */public class Test { static class Man { String name; int age; char g; public Man() {} public Man(String name, int age) { this.name = name; this.age = age; } } /** * Method test for testing javadoc * @param a test param * @return an int */ public int test(int a) { return a; } /** * Test Main Method * @param args test args * @throws exceptions No exception thrown */ public static void main(String[] args) { Man a = new Man(); System.out.println(a.age); int b; }}
Generate document commands
Javadoc test. Java-author-version-private-D./doc
For more information, see man javadoc.