Java's OOP

Source: Internet
Author: User

Default value of a property in a class

1. The default value for the initialization of the number type (int,short,byte,long,float,double) is 0

The default value for 2.boolean initialization is false

3. The default value for the initialization of a reference type is null. such as String type

The default value for a property in a method in a class is not

This is an important difference between the two. Therefore, the properties in the method must be assigned when used.

The search order of the class (descending by Priority):

1 Current compilation unit (that is, within the same class)

2 single-type import (single-type is specified, deterministic, e.g. import Com.sh.dj.Dog)

3 other classes in the same package

4 on-Demand import (import com.sh.dj.*)

Classes that do not require explicit import, such as classes in the Java.lang package,

String is one of the classes

System also does not need to import explicitly

The following are some of the packages in the JDK

Java.lang Core Class

Java.util Tool class, collective frame

java.io input and output streams

Java.nio new input and output streams

java.sql JDBC Related classes

java.net Network Programming class

Java.time Time Processing class

Java.swing UI Class

Method

Method Concepts

Closed business logic

Improve code Reuse

Declarative syntax for methods

The return value of the method

return value, return the value with return, type of the value type

No return value, the return type is void

Invocation of an argument-free method

Java's OOP

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.