Java and object-oriented design

Source: Internet
Author: User

1 Object-oriented and process-oriented

Features of 2.OO

(1) Encapsulation

(2) Inheritance

(3) Polymorphism

3.Class and Object

(1) Define a class

(2) gloables and local variables

(3) constructor ' s defination and application

(4) Create an object

Declration an Object

Allocate memory

(5) Use an object

Use the member variables and change them

Use the member function

Use operator '. ' To access the member variables and functions

(6) Deallocate an object

Java use the ' garbage collection ' to deallocate the Memory:first:estimate whether a variable are in use; Second:deallocate

Java also provide a function "finalize ()" Before "garbage collection" for "garbage collection System" (Got hazed, GCs are D Iffer from GC?)

4.use Packages

def: (1) In essence facilate the search and use of a specfic class

(2) There exists the Cogniminal class, to some extent, this can avoid the conflict of nominate

(3) In Java, Access right, measured in packages

Create a package:

Use classes in the same package and public classes in other packages:

(1) long names connected by dot

(2) Use keyword ' import ': Import pack.class|*


This article is from "Maugham's Advanced Journey" blog, please make sure to keep this source http://maugham.blog.51cto.com/13056751/1969777

Java and object-oriented design

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.