In their minds to create a model for strengthening in-depth understanding of Java, if you encounter doubt, you will be it back to your model, and deduce the answer.
Each object has an interface
Although the object-oriented programming, we actually do to create new data types, but virtually all object-oriented design languages are used to represent data types Class Keywords. When you look at the type (Type) time when Please send it as a class (Class) to consider, and vice versa.
Object-oriented approach is not restricted to building simulation program, any program is your system, a simulation of the design concept, object-oriented technology is indeed a lot of problems can be explained as a simple solution.
Each object the provision of services
The object as a service provider is a great look at a simplified tool, not only very useful in the design process, but when others are trying to understand your code or reuse an object, it will be an object designed to be adjusted to adapt to its process becomes much simpler.
Concrete realization of hidden
public that the element followed by any person are available.
In addition to the type that creates private and internal methods of this type can not be accessed by anyone other than the elements.
The difference is protected and private access to protected members of inherited classes.
default you can access the same package in the other members.
Inheritance: multiplexed interface
Generated by the type of inheritance is to understand the equivalence of object-oriented programming method content as an important gateway.
- Is a (is-a) and as a (is-like-a) relationship between
is-a: exactly the same interface type
is-like-a: add a new interface element
Interchangeable objects with polymorphism
- Abstract base classes and interfaces
Abstract: abstract class abstract methods can only be created internally, when the class is inherited, the abstract method must be implemented otherwise the derived class is still an abstract class. To create an abstract method allows you to be a method interface without having to be placed in force may be meaningless for this method provides the method body.
Interface: provides the interface to achieve a perfect separation, multiple interfaces can be grouped together
Interface can inherit multiple interfaces.
Class does not allow multiple inheritance the main reason is that if A and B at the same time inherits C, while the b and c at the same time there is a D method, A how to determine the inheritance and that one?
But the interface does not exist such problems, the interface are all abstract methods inherited no one indifferent, so interfaces can inherit multiple interfaces.
interface b ()
interface c ()
interface a extends b, c () / / right
class b ()
class c ()
class a extends b, c () / / error
Class inheritance and interface implementation, interface also can be inherited interface. .
Object creation, use, and life-cycle
C + + object-based storage space and life-cycle when you can actually write programs.
Java dynamically created objects.
C + + must determine programmatically when to destroy the object.
Java automatic discovery of an object when no longer used.
- Collection (collection) and iterator (iterator)
List (list, used to store sequence)arraylist: random-access element is a fixed time spent operating
linkedlist: randomly selected elements need to move in the list, its price is high, access to the more close to the table at the end of element, it takes longer.
On the other hand, if you want to insert an element in the sequence of the middle, linkedlist smaller than arraylist.
At the design stage, you can use linkedlist, in optimizing system performance, the use arraylist. Base class List and iterators arising from the abstract to you to switch between the container when the impact of the code down to a minimum.
Map (hash table, also known as an associative array, used to establish the association between objects)
Set (set of classes used to store a class object)
Queue (queue), Tree (the tree), Stack (Stack)
- Single inheritance structure
- Downcast (downcasting) and template / generic (template / generic)
- Ensure the correct clear
- Garbage collection and efficiency and flexibility of
Exception handling: Handling errors
Java and the Internet
- What is the web
- Client-side programming
- Server-side programming
Why is the success of Java
- System is easy to express, easy to understand
- Received the greatest support through the library
- Error Handling
Java and C + +
Related Posts of Object reference on the first chapter - reading notes
Ruby is a quick and simple for the interpretation of object-oriented programming-based scripting language - This is what does that mean? Interpretative scripting language: By the operating system's ability to directly call Powerful string operati ...
blue_collar.prototype.age = "33"; blue_collar.prototype.say = function () ( alert ( "my name is" + this.name); ); function city_blue_collar () ( ) city_blue_collar.prototype = new blue_collar (); var jj = new city_blue_collar; jj.say (
Abstract factory pattern is an abstract factory pattern than an even higher degree of model. In short, the abstract factory class and the factory class of the same principle, only factory class is back in the general category and examples; and return the
1: Dynamic prototype method: function Car (iDoors) ( this.door = siDoors; if (typeof Car._initialized == "undefined") ( Car.prototype.showColor = function () (alert (this.color)); ) )
I hate the thought of the time to teach some provide a lot of code, because I think the thought process of acceptance should be a pleasure to read as a novel process, rather than spend a lot of brain power for a certain process details And this world ...
What is object-oriented design? Contains what? The benefits of it are what? Required to pay what you do? In today's age, ask these questions seem to be foolish, because this year almost every software developer knows how to use some sort of objec ...
JAVA interview questions 1, object-oriented features of what has 1. Abstract 2. Inheritance 3. Packaging 4. Polymorphisms 2, String data types are the most basic right? Basic data types include byte, int, char, long, float, double, boolean and short. java