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

输入三个值,进行条件判断

时间:2014-07-24 23:44:24      阅读:307      评论:0      收藏:0      [点我收藏+]

标签:str.equals(str1)的使用

import java.util.Scanner;
class Test4 
{
    public static void main(String[] args) 
    {
        Scanner s=new Scanner(System.in);
        System.out.println("身高:");
        System.out.println("财富:");
        System.out.println("帅否:");
        int height=s.nextInt();
        double money=s.nextDouble();
        String str=s.next();
        boolean m=str.equals("是");//输入“帅否”的值和str.equals("是")的参数“是”作比较,相同,则返回真(true)

        if(height>=180&&money>=10.0&&m==true){
          System.out.println("我一定要嫁给你!");

        }else if(height>=180||money>=10.0||m==true){
            System.out.println("嫁吧,比上不足,比下有余。");
        }
        else
             System.out.println("一定不会嫁给你!");
    }
}


本文出自 “第一天的课” 博客,请务必保留此出处http://5453607.blog.51cto.com/5443607/1529856

输入三个值,进行条件判断,布布扣,bubuko.com

输入三个值,进行条件判断

标签:str.equals(str1)的使用

原文地址:http://5453607.blog.51cto.com/5443607/1529856

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