Java Foundation Day7

Source: Internet
Author: User

1/Anonymous Class object: The object that created the class is anonymous.

For example , new Circle() is an anonymous class object.

Anonymous class objects can only be used once.

2/formal parameter: When declaring a method, the parameters within the method parentheses

Arguments: The calling method is the value of the actual passed-in parameter

3/rule: In Java, value passing is performed.

A parameter is a variable that passes the value of an argument to the base data type of the base data type

A parameter is a reference to a data type, and the value of the argument's reference type variable is passed to the reference of the formal parameter

4/object-oriented feature one: encapsulation

* objects are created after the object of the class is passed directly. property is assigned to an object, an unexpected occurrence may occur that is not true. We consider that the object is not directly acting on the property, but through the object . method to control the object's access to the property. We are now privatizing the properties in the class.

the property of the Private adornment can only be called in the original, that is, it is called in a common way.

Encapsulation Idea: privatization of properties, providing common methods (such as set and get methods).

5/Permission modifier:Public Private default state (default)protected

Can be used to modify properties and methods.

6/this can be used to modify properties / methods / constructors.

This is understood as the current object or the object that is currently being created.

This (formal parameter) can explicitly call other overloads of this class for the specified constructor.

This (); The constructor that called the null argument.

If there are N constructors in a class, there is a maximum of n -1 constructors used this ();

Public person (String name) {this.name =name;} Public person (String Name,int age) {this.name = Name;this.age = age;} Can be written as public person (String name) {this.name =name;} The public person, String name,int age, {this (name);//syntax requires this statement to be written in the first row of the constructor this.age = age;}

7/javabean is a reusable component written in the Java language.

Compliant: The class is public/has a parameterless public constructor/attribute, and has a corresponding Get/set method of the Java class, which is JavaBean.

8/UML Chart

 

Java Foundation Day7

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.