Object reference on the first chapter - reading notes

Program design is the management of complexity

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

Late binding

  • 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 + +


分类:Java 时间:2010-03-29 人气:251
blog comments powered by Disqus


  • python2.x Study Notes (4)-Python object 2010-03-11

    1. All right, like Python have three characteristics: identity, type and value. Status: Each object has a unique identity itself, the identity of any object you can use the built-in function id () to get. This value can be considered to be the object

  • SQL Server data types conversion (Abstract) 2010-12-28

    Simplify the Java programming language data types to SQL Server data types conversion, Microsoft SQL Server JDBC Driver provided by the JDBC specification requires the data type conversion. To increase flexibility, all types with Object, String and b

  • Programming Ruby 2nd reading Notes 3 2009-04-23

    C08 Exceptions 1. The definition of an Exception class MyException < StandardError def initialize(info) super(info) end end 2. Dished out and catch an exception require 'my_exception' def raise_exception raise MyException.new("ERROR occurs!!!"

  • Programming Ruby 2nd reading Notes 2 2009-04-20

    C05 Standard Types 1. String print <<STRING1,<<STRING2 Concat STRING1 enate STRING2 produces: Concat enate 2. Range a = 1..3 #a = 1,2,3 a = 1...3 # a = 1,2 (1..10) === 5 ! true (1..10) === 15 ! false (1..10) === 3.14159 ! true ('a'..'j') === '

  • Programming Ruby 2nd reading Notes 4 2009-04-23

    C10 Basic IO 1. Basic input-output while line = gets puts(line) end If ruby copy.rb a.txt, then, as the input file a.txt. 2. File common method File.open("testfile") do |file| file.each_byte {|ch| putc ch; print "." } end File.open(&qu

  • Programming Ruby 2nd reading Notes 5 2009-04-26

    C12 Unit Test Directory structure is as follows lib / person.rb test / tc_person.rb #person.rb class OldAgeException < StandardError def initialize(info) super(info) end end class Person attr_reader :name, :age, :gender attr_writer :name, :age, :gend

  • JavaScript Array Object Reference Manual (directory) 2009-03-18

    JavaScript Array Object Reference Manual Note: FF = Firefox, N = Netscape, IE = Internet Explorer Array Object Ways Description FF N IE concat () Connect two or more of the array, and return results 1 4 4 join () Put all the elements of the array int

  • JavaScript Array Object Reference Manual prototype property 2009-03-19

    JavaScript prototype property Return JavaScript Array Object Reference Manual (directory) The definition and use of prototype property to the object (in this case refers to Array array) to add properties and methods. Grammar Array.prototype Followed.

  • JavaScript Math Object Reference Manual prototype property 2009-04-08

    JavaScript prototype property Return JavaScript Math Object Reference Manual (directory) The definition and use of prototype property can be added to the object properties and methods. Math object is not as Date and String objects as are the class, t

iOS 开发

Android 开发

Python 开发



PHP 开发

Ruby 开发






Javascript 开发

.NET 开发



Copyright (C) codeweblog.com, All Rights Reserved.

CodeWeblog.com 版权所有 闽ICP备15018612号

processed in 0.036 (s). 11 q(s)