【问题标题】:How to add two scanner strings together? in 'if' statement [duplicate]如何将两个扫描仪字符串加在一起?在'if'语句中[重复]
【发布时间】:2016-08-18 11:31:36
【问题描述】:

我是 Java 新手,我正在尝试将来自扫描仪对象的两个数据字符串添加到一起。

我想说

if(age.equals("child")) AND sex.equals("male")) THEN System.out.println etc; 

下面这段代码是我目前所拥有的。我还有一个代码:sex.equals("male")

if(age.equals("child")){
        System.out.println("1. Male child shirts are on the 5th floor");
        System.out.println("2. Male child trousers are on the 6th floor");
        System.out.println("3. Male child shoes are on the 6th floor");
    }

我希望这不会太令人困惑。我是学习 Java 的新手,只学习术语。

谢谢

【问题讨论】:

标签: java if-statement


【解决方案1】:
if(age.equals("something") && sex.equals("your_var")){
        System.out.println("your response")
    }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-04-09
    • 1970-01-01
    • 2014-09-18
    • 1970-01-01
    • 2016-06-20
    • 2014-11-22
    • 1970-01-01
    相关资源
    最近更新 更多