Today, a formal graduation, a company in Beijing also successfully concluded the internship. From school back to Beijing directly after the positive, although today in Saturday or go to the company around, has been trying to take a good look at the "Thinking in Java" (fourth edition), graduated, wholeheartedly into the work, naturally also have time, from today began to look at the side of this book, Make your own base in Java a bit stronger. The beginning is a little bit of nonsense, and then straight into the text. Because they have a certain Java base, so it will be very hasty, only to record some of the relative difficulties and their own knowledge gaps, and we share, so this series of things are not suitable for no Java based friends slightly.
page 2nd , object-oriented programming approach:
1 All things are objects.
2 The program is a collection of objects, they send messages to tell each other what to do.
3 Each object has its own storage composed of other objects.
4 Each object has its type.
5 All objects of a particular type can accept the same message.
On page 5th , the reason for access control exists:
1 Let client programmers (using data type consumers) not touch the parts they should not touch.
2 allows library designers to change the way they work inside a class without worrying about affecting the client programmer.
page 5th , access the specified word (access specifier):
1) public, which means that the elements immediately following are available to anyone.
2 private, which means that the element immediately following is not available to anyone other than the type creator and the internal method of the type.
3 protected, and private function, the difference is only the inherited class can access protected decorated elements, but still cannot access private decorated elements.
4) Default access, which is the default permission, also known as package access, when the specified word is not used for the above three types of access. Under this permission, a class can access members of other classes in the same package (library build).
page 10th , a difficult point is also a programming trick about inheritance . The process of being regarded as the parent class is called upward Transition (upcasting).
page 11th , the single root inheritance structure (except C + +, all OOP languages are one inheritance structure, the ultimate base class object) has great benefits, such as:
1 The single inheritance structure ensures that all objects have certain functions. In your system you can perform some basic operations on each object, all objects are easily created on the heap, and parameter passing is greatly simplified.
2 The single inheritance structure makes the implementation of the garbage collector much easier. Because all objects are guaranteed to have their type information, there is no deadlock because the type of object cannot be determined. This is particularly important for system-level operations, such as exception handling, and provides greater flexibility in programming.
page 12th , parameterized type (called generics in Java ): A compiler can automatically customize classes that work on a particular type. For example, by using a parameterized type, the compiler can customize a container that only accepts and takes out the specified object.
page 13th , object creation and life cycle sections focus on the comparison between C + + and Java.
Spent 17 days to read a chapter, the efficiency of 0, the company a little more, the future must seize the time. Read a chapter to remember a concept OOP (object-oriented Programming) object-oriented programming