Java Programming 5

Source: Internet
Author: User

Java Programming 5

(i) Classes and objects:

Class

1. Properties

2. Behavior (method)

}

1) What is abstract:

From a specific point of view, from the existing things to extract the characteristics of concern, behavior, and thus form a new thinking process of things, is a kind of from the complex to the simple way of thinking;

(object: Real existence, entity);

2) describe human beings:

(A class is an abstraction of an object that is an entity generated by a class)

(1) Constructor:

Public Student () {

System.out.printLn ("This is the default constructor used");

}

* Features of the constructor:

1 "When creating an object, make a call after the new keyword;

2 "The constructor is also a method that does not require any return type compared to the normal method;

3 "The method name of the constructor is the same as the class name;

4 The constructor can also be used for object property initialization in addition to allocating memory for objects (using a parametric constructor);

5 if the parameter constructor is set in the class, the default constructor is not provided;

6 "The constructor can be overloaded;

* Constructor Function:

1) The created object is stationed into memory through the constructor (allocating space to the object in memory)

2) initialize attributes;

* * Constructor Purpose * *:

(Allocate storage time for objects when creating objects)

(ii) Packaging ideas:

Package {

Project name Structure

Enterprise Project Structure

Java Common package Name

}

Package Packages:

Naming rules:

1. The letter part is lowercase;

2. Enterprise (organization) domain name inverted. Team name. Name of the project;

Access modifiers:

Private no prote cted pubic

Inside the class ~ ~ ~ ~

Same Package ~ ~ ~

Sub-class ~ ~

Any Place ~

Java Programming 5

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.