thinking in java (1)

1. An object has state, behavior and identity.

2. Indeed, one of the challenges of object-oriented programming is to create a one-to-one mapping between the elements in the problem space and objects in the solution space.

3. In a good object-oriented design, each object does one thing well, but doesn't try to do too much.

4. Java uses dynamic memory allocation, exclusively(primitive types). Every time you want to create an object, you use the 'new' operator to build a dynamic instance of that object--on the heap. And the java garbage collecctor will automatically discovers when an object is no longer in use and destroys it.

5. five different places to store data:
   a. Registers(inside the processor, no direct control in java)
   b. The stack: live in RAM, has direct support from the processor via its stack pointer.
   c. The heap: pool of memory where all java objects live
   d. Constant storage
   f. Non-RAM storage:

6. High-precision numbers: BigInteger and BigDecimal

7. Default values for primitive members. The default values are only what java guarantees when the variable is used as a member of a class.
This guarantee doesn't apply to local variables(i.e. within a method)

8. Methods in java can be created only as part of a class.A method can be called only for an object(except for static methods which can be called for the class, without an object)

9. there will be only one piece of storage for static field, no matter how many object you make(by new operator).

10. As the computer revolution progresses, "unsafe" programming has become one of the major culprits that makes programming expensive.

你可能感兴趣的:(java,C++,c,F#,C#)