day-03-02

Source: Internet
Author: User

A function is defined in a class with a specific function of a separate applet, the function of the format modifier return value type function name (parameter type argument 1, Parameter type form parameter 2, ....) ){

Execute the statement; return returns a value;}, this person thinks the main function main this should be a special function.

For a function that does not have a specific return value, the return value type is represented by the keyword void, which can be omitted in the last line. Functions can only be called in a function, and a complement may define a function inside a function. When a function is defined, the result of the function, ING, is returned to the caller for processing by the caller.

A function that has no output cannot be output. In other words, it cannot be system.out output.

It is recommended that loop statements be placed in functions.

Overload concept of a function: In the same class, more than one function of the same name is allowed, as long as they have a different number of arguments or parameter types.

Features of overloading: independent of the return value type, look only at the argument list. Advantage, convenient to read, optimize the program design.

When the defined functionality is the same, the unknown content of the participating operation is different. Then define the same name.

The concept of an array: a collection of data of the same type. The array is actually a container

Array, you can automatically number elements in an array starting with 0 to facilitate the manipulation of these elements.

Format 1: element type [] Array name = new element type [element number or array length]; example: int [] arr = new Int[5]

Format 2: element type [] Array name = new element type []{element, element, ...} example: int [] arr =new int[]{3,6,1,7}

The data invocation of an array needs to know more about how it is stored in memory, and I have to read it a few more times.

An array has a property that can get directly to the number of array elements.  Length. Use method as array. length;

Array is sorted because of the sort function with the until cell. Not in a very detailed look.

Binary lookup, improve efficiency, but you must ensure that the array is an ordered array.

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.