Output parameters of Java code and (coercion type conversions)

Source: Internet
Author: User

Description (because Java application parameters in Java are the default character-type data, you need to enforce the type conversion step)

Design ideas:

Enter several parameters into the system, calculate the number of parameters, and use the For statement to calculate the parameters. (Mandatory type conversions are required in the program because the data in Java application is character-type and cannot be performed), and the final output parameter

Flow chart:

Program Source code:

 Packagedemo; Public classCommandParameter {/**     * @paramargs*/     Public Static voidMain (string[] args) {//TODO auto-generated Method StubSystem.out.println ("Number of parameters:" +args.length); intM=0;  for(String Arg:args) {m=m+Integer.parseint (ARG);    } System.out.println (M); }                }

Output parameters of Java code and (coercion type conversions)

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.