Java programming ideas (third edition) - Study Notes

 

   Recently doing a SpringSource training and aspects of the preparation vCloud, check some information online, wanted to get knowledge of Java aspects of re-go over, so the Java programming ideas and then re-live it, I do have the fourth edition Chinese version and English version of the third edition, due to the angle and easy to learn English (electronic version is not so heavy) angle chose English Third Edition Java programming ideas, while learning to do some comparisons and notes, hundreds of millions as bad written it.

==============================================================================

Take a look at Thinking in Java 3rd directory, first look at the book's about, and then little by little depth of it, the object introduction, full of objects, program flow control, initialization and removal, hide the implementation, multiplexing, and more state, interfaces, error handling, container, I / O system, let us work together slowly in-depth understanding of it, come on, I'm a bit less contrast with the fourth edition of the contents of the "generics, reflection and multi-threading" direction of it, but never mind these and other fundamental part of it had finished, and then study "generics, reflection and multi-threaded" it:

Ctlog:

1. Introduction to Objects

2. Everything is Object

3. Controlling Program Flow

4. Initialization & Cleanup

5. Hiding the Implementation

6. Reusing Classes

7. Polymorphism (polymorphism)

8. Interface & Inner Classes

9. Error Handling with Exceptions

10. Detecting Types

11. Collections of Objects

12. The Java I/O System

13. Concurrency

14. Creating Windows & Applets

15. Discovering Problems

16. Analysis and Design

 

===========================================================================

Chapter 1. Introduction to Objects 

 

This chapter introduces the basic concepts including an overview of development methods, including OOP, to help the reader a solid understanding of object-oriented programming.

 

1. abstraction

A concise description of the object: The object has state, behavior and identity. Each object can have (state of the object), and methods (behavior) of the internal data, and each object can be uniquely distinguished from other objects, each object a unique address in memory.

2. Each object has an interface

3. Each of the services offered

4. hidden embodied

The roles are divided into categories according to the programmer and the creator of the client programmer.

The first reason for the existence of access control: Let the client programmer can not touch them should not touch the part, which is the client programmer is actually a service, because they can easily see those things for them it is very important, and what things can be ignored.

The second reason for the existence of access control: Allows designer to change the internal work without fear will affect the client programmer.

Java with three key setting boundaries (public, private, pretected) within the class. These access access to the specified word immediately following the decision defined Oh Naxi whom can use.

public for anyone can use.

private think was a brick wall between you and the client programmer, if someone uses to access private members, you'll get an error message at compile time.

The protected keyword and private considerable role, with differences only in integrated classes can access pretected members,

There is also a Java default access, but did not use any access previously mentioned when the specified words, it will play a role. Called package access, because in this privilege, class members can access other classes in the same package, but outside the package, like those members designated as Private.


The specific implementation multiplexing

Code reuse, the use of conventional synthesis of new classes of classes, this concept is called composition (Composition), if the combination is the occurrence of dynamic, often referred to as polymerization (aggregation). Combination is often seen as "has-a" relationship has, "car ownership engine"

In fact, when creating a new class, you should first consider the combination, because it is more simple and flexible. With this configuration, the design will become more clear. Once you have some experience, it can be seen that the situation must be integrated.


6. inheritance

  When you inherit an existing type, it created a new type. This new type not only include all members of the existing type (although private members were hiding, and can not access), but more importantly, it copied the interface of accumulation.

  Equivalence type generated by integration threshold is important for understanding the design method connotation target program.

 

There are two ways to make the base class and derived class variance. The first method is very straightforward: add a new method directly in the derived class. These new methods are not part of the base class interface. The second and more important one between the derived class and the accumulation of a difference is to change the behavior of existing methods and base classes, known as "covering overriding" that method. To cover a method, this method can be created directly in the new definition in class everywhere you can. You can say "At this point, I'm using the same interface methods, but I wanted to do different things in a new type."

 

 

 

 

 

 

 

 


 

 

 

 

 

Reproduced in: https: //www.cnblogs.com/licheng/archive/2010/08/02/1790224.html

Guess you like

Origin blog.csdn.net/weixin_34415923/article/details/92634316