Java-preliminary Understanding-fifth-array-tabular method exercises

Source: Internet
Author: User

One.

Tabular method is a kind of thought, is a kind of life will exist in the operation.

The tabular method is characterized in that there is a correspondence relationship. The corresponding relationship is numbered on the side of the order. If the ordered number does not start with 0, reset the corner mark.

Week can be used to look up the table method, Monday is Monday, Tuesday is Tuesday .... The tabular method corresponds to the two sides, one must be ordered by the number. Ordered numbers, can be converted to the angle of the array, or how to call the table method, where the table is an array.

Because of the string type that is returned here, the string type is, for example: string a= "abc"

Simple practice, check the use of the table method. The whole idea is this: in the main function, the input data calls the Getweek function, gets the corresponding string return value, and then outputs it. Under the main function, a function is defined independently to obtain the corresponding weekday string. The input is of type int data, which returns string of type String. Because the corresponding relational data is more, define an array to store them, and the type of the array is the character type. The input data is the angle of the array, after the definition of the array, the corresponding angle of the array data, that is, return arr[num]; One thing to note here is that the array is labeled for its own element, starting with 0, so when Num=1 is the second element in the array, precede it with a null character. From the entire input, you want to limit the range of input data.

Java-preliminary Understanding-fifth-array-tabular method exercises

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.