patrickB patrickB - 2 months ago 4x
Java Question

How to add two scanner strings together? in 'if' statement

I'm new to Java and I'm trying to add two strings of data together from a scanner object.

I'm wanting to say

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

This code below is all I have so far. I also have a code: sex.equals("male")

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");

I hope this isn't too confusing. I'm new to learning Java and only just learning the terminology.


if(age.equals("something") && sex.equals("your_var")){
        System.out.println("your response")