patrickB patrickB - 3 months ago 10
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")

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


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

Thanks

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