Java Process Control--2017.08.01

Source: Internet
Author: User

Package Collection;import Org.omg.corba.systemexception;public class Ifexpression {public static void main (string[] args) {        //if expression for Boolean expression or Boolean value//First way int a=5;int b=7;int c=84;if (a<b) {System.out.println ("a less than B");}         The second way if (a>b) {System.out.println ("a greater than B");} else {System.out.println ("A is less than B");} The Third Way if (a>b) {             System.out.println ("A greater than B");} else if (c<b) {System.out.println ("C less than B");} else {System.out.println ("C is greater than B");}}}

Enum class

Package Collection;import Java.util.scanner;public class Switchexpression {//enum type enum Season{spring,hot,fall,winner} ;p ublic static void Main (string[] args) {//TODO auto-generated method stub////Here is an integer value//scanner scanner=new Scanner (System . in);//int int1=scanner.nextint ();//switch (int1)//{//case 1://{//system.out.println ("A");//break;//}//case 2://{/ /system.out.println ("B");//break;//}//default://{//system.out.println ("Stop");//}//////85////stop    season Tianqi=season.fall; Switch (TIANQI) {case   spring:  {   System.out.println ("Spring");   Case Fall:   {   System.out.println ("Autumn");   Default:break;}}}

It is important to note that the 1 enumeration class uses the basic format of the 2 switch statement 3 to pay attention to break, if break does not write, the program may be compared with the value in each case

Java Process Control--2017.08.01

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.