码迷,mamicode.com
首页 > 其他好文 > 详细

我的成果2

时间:2017-04-09 17:17:53      阅读:103      评论:0      收藏:0      [点我收藏+]

标签:amp   put   import   数字   demo   static   ati   多重   class   

                                                                          if的分类
                               1 :if  else结构;

                               

import java.util.Scanner;


public class Demo0 {//外成结构

 public static void main(String[] args) {//内城结构
  Scanner input=new Scanner(System.in);
  int cose=input.nextInt();
  if(cose>85){
   System.out.println("一辆跑车");
  }else{
   System.out.println("打屁屁");
  }
  

 }

 

}

                                      2 : 多重if结构

                                   

import java.util.Scanner;


public class Demo0 {//外成结构

 public static void main(String[] args) {//内城结构
  Scanner input=new Scanner(System.in);
  int cose=input.nextInt();
  if(cose>85){
   System.out.println("一辆跑车");
  }else if(cose<=85 && cose>=80){
   System.out.println("一辆小轿车");
  }else if(cose<=80 && cose>=70){

     System.out.println("摩托车");
   }else{

System.out.println("自行车");

}

 }

}

                          3 :嵌套if;

         

import java.util.Scanner;


public class Demo0 {//外成结构

 public static void main(String[] args) {//内城结构
  Scanner input=new Scanner(System.in);
 System.out.println("请输入数字");

 int cose=input.nextInt();

System.out.println("请输入性别");

 Char name=input.nextCharAt();

if(cose<10){
   System.out.println("进入决赛");

 

 if(name.equuals(‘男‘)){

System.out.println("进入男子组");

}else if(name.equals("女")){

System.out.printlnl("进入女子组")
  }else{
   System.out.println("淘汰");
  }
  

 }

}

我的成果2

标签:amp   put   import   数字   demo   static   ati   多重   class   

原文地址:http://www.cnblogs.com/shenjunxiu/p/6685175.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!