Java Statement type

Source: Internet
Author: User

 Public classTest { Public Static voidMain (string[] args) {System.out.println ("Test is OK"); //T value entered by the customer        intt = 100; //Statement        if(T < 18) {System.out.println ("Very small."); }        Else {            if(T < 30) {System.out.println (Young people); }            if(T > 90) System.out.println ("Too old."); } System.out.println (Welcome); //If there is no {}, only the next statement is affected, and if you need to influence multiple statements, you need to enclose it in {}. {} stands for scope        intW = 2; String s= "10";//jdk1.7 Support for strings above version        Switch(s) { Case"0": System.out.println ("Today is Sunday");  Break;  Case"1": System.out.println ("Today is Monday");  Break;//If break is removed, execution continues down until a break is encountered//two different cases, the same result, can be removed break, penetrate to the next layer         Case"2": System.out.println ("Today is Tuesday");  Break;  Case"3": System.out.println ("Today is Wednesday");  Break; default: System.out.println ("Incorrect input");  Break; }                //Loops    inti = 10;  while(I > 0)        {            if(i = = 8) {i--; Continue; } System.out.println ("*"); if(i = = 5)             Break; }                         Do{System.out.println (i++); }         while(I < 10);//"Do" loops at least once,System.out.println ();  for(intm = 0;m < 10; M + +)        {            if(m = = 8)Continue; System.out.println ("M =" +m); }        //TODO Auto-generated method stubs    }}

Java Statement type

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.