Mu Net-android engineer first form the if...else of -4-2 Java conditional statement

Source: Internet
Author: User

Source: http://www.imooc.com/code/1354

The operation of the If...else statement is one step more than an if statement: when the condition is true, the code block of the if part is executed, and if the condition is not true, the else part is entered. For example, if the test result is more than 90 points, reward an IPHONE 5S, or do 500 push-ups.

Grammar:

Execution process:

Such as:

Task

Try If...else ... Look at your age!

Please complete the code in the blank space in the editor and implement the function "if the age is greater than or equal to 18 years old, then prompt adulthood, otherwise prompt minors"

Operation Result:

1  Public classHelloWorld {2      Public Static voidMain (string[] args) {3         intAge=25;4         5         if(Age >= 18) {6SYSTEM.OUT.PRINTLN ("adult");7}Else {8System.out.println ("minors")); 9         }Ten     } One}

Mu Net-android engineer first form the if...else of -4-2 Java conditional statement

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.