A Shortcut keys in eclipse:
Ctrl+shift+f automatic sorting of selected Java code
alt+/generate parameterless constructors or promote information
Alt+shift+s+o Generation with parametric construction
Ctrl+shift+o Quick Import Package
Alt+shift+s+r tab+enter-->shift+tab+enter quick Generate Get Set method
CTRL+F11 Quick Run Code
Description: Shortcut keys can quickly help us generate code, reduce development time, improve efficiency, remember a few main can, others can right mouse in the Eclipse editor, select Sourse in the popup menu item, select in its submenu item
(ii) data types in Java
Java data types are divided into: basic data types and reference types
Basic data types are divided into: numeric Boolean character type
Reference type: Class interface array, etc. (except for basic data types are reference types)
(iii) memory analysis in Java
1. First memory is divided into 2 parts: stacks (local variables are inside the stack, space is contiguous) and heaps (the New keyword comes out of the object, space discontinuity)
2. Heap words: Divided into ordinary heap (storage of new objects) and method area (class loader loaded into the class code, static methods and variables, Chang (string constants), etc.)
3. Let's first define a simple class:
Description: The People class, with 2 properties, a reference type of string, and a basic data type int, initialized in the constructor, of course, the constructor has a return value, the object address is returned, the This keyword points to the object that will be instantiated, The This keyword and the Super keyword are implicit parameters of the methods in the class that can be used directly in the method, and the Super keyword is a reference to its immediate parent class object
4. Write a Main method in the class, the entry of the program:
First the class loader loads the people class and other classes used in the class, stored in the method area of the heap, People p=new Peolpe ();
Description: P is a local variable stored in the stack, which is stored in a 4-byte space address. New people () means that an object is created in the heap as a template of a class, because it is a parameterless construct, its member variable, the reference type is null, and the base data type is 0 in some sense.
Look down.
P.name=new String () and p.age=18 in-memory analysis
Description: Using the P reference to find the object inside the heap, find its string Name property, and let it point to the new newly-created string object in the heap, and the Int age property, is directly stored 18 This value, so say, the basic data type stored value, the reference type holds the space address, say a two-bit array, Look at the code below
Draw a picture of its memory:
Description: First, a points to an object in the heap that has 2 reference properties, then the Object 2 reference properties point to another 2 arrays, because the two-bit array items are not assigned, according to the int type, the default value is 0, if it is a reference type, then NULL
5. Of course there are methods, in the new object of the ordinary method, is not with the static keyword method, it also has an address, point to the method area of the class code in the method, implement the call, and then the method has parameters, it will open a space in the stack to store the local variable, if the parameters of the basic data type , the stored value, if the parameter of the reference type data type holds the space address, and then the space address to find the object it points to, to do the operation of the method
6. Methods and variables with static in the method area, which are subordinate to the class, can be called by the class name. Call the method directly, not dependent on the object
7. Is a string constant in a constant pool: for example
Description: "I am a string" is a string constant in a constant pool, drawing its memory analysis diagram
Draw the memory graph and know, str1==str2 return value Why is true, because they point to the same place, store the space address is the same, so return true
8. About the inherited memory analysis diagram is not drawn, in fact, it is very simple, in the subclass of the constructor default has super () This line of code, call the constructor of the parent class, this is why when the child class object is created, the parent class object is created, if a method is called, not in the subclass, the parent class will be found The same is true with attributes
9. The reference type is NULL, of course not null, and also points to a memory space in the heap.
(reproduced, see http://www.cnblogs.com/shangxinfeng/p/6617636.html in the original)
Eclipse Common knowledge points