Java programming 56-method exercises

Source: Internet
Author: User

Java programming 56-method exercises

Chen yuefeng, Zhengzhou game college

From: http://blog.csdn.net/mailbomb

7.9 method exercises

Requirement: Compile the corresponding function method and call the function of the test method to determine whether to implement the function.

1. Evaluate the absolute value of the byte type. Whether the following data testing methods are complete and reasonable:-10, 0, 100,-128.

2. Convert lowercase to uppercase. If the character is not lowercase, the system returns itself. Test data: 'A', 'F', and '2 '.

3. Calculate the sum of all elements in the integer array. Test data: {1}, {0, 3, 2, 12 }.

4. Rounding a decimal number to an integer. Test data: 0.1, 1.7

5. Sort arrays in ascending order (from small to large. Test data: {3, 10, 9, 2, 3}

6. Print all the even numbers between 1 and. 10 digits are displayed on each line, and the numbers are right aligned.

7. Convert the corresponding numeric characters (such as '1' and '4') to the corresponding numeric (such as 1 and 4). If the conversion fails,-1 is returned. Test data: '5', 'A', and ','-'.

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.