Java Learning (11)

Source: Internet
Author: User

1. Packages (package) in Java

2.1 packages, corresponding to folders on disk

2.2 Create a new class that defaults to the default package

2.3 Declaring the Package keyword: packages

Package statement, pinned location

2.4 Importing a package keyword: import

Import package name. Class Name (* denotes all);

2.5 Effects:

Classify, resolve conflicting names

Classify and store, easy to find and manage

2.6 Naming conventions--reference materials

2 . Methods with Parameters

2.1 How to declare

Public return type method name (data type parameter name) {

.... Method body


2.2 Divided into 2 categories

2.2.1 No return type--void

2.2.2 has return type

Basic data types

Custom Classes-- return object of the class ;

Arrays-- return Array name ;

2.3 Types of parameters

Basic data Type (10-31)

Custom Classes--passing objects of a class

Array--only the "array name" needs to be passed

2.4 Calls

2.4.1 called in the current class--Method name (value list);

2.4.2 called in other classes--object name. Method Name (value list);

Iii. Summary of methods


1, no return type, no parameters

2, no return type, parameters

3, there is a return type, no parameters

4. There are both return types and parameters

parameter or return type, which can be a common data type or a custom class or array

Java Learning (11)

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: 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.