So with my basic code I was curious if it is possible to have an if statement like below:
if (ScannerInput.equalsIgnoreCase(AllEnums)){
System.out.println("Sample");
}
If you understand I wish to have just the name of an Enum for example for it to be true to all values. If this is possible, how do I go about it?
Here is an example of what I mean:
import java.util.Scanner;
public class EnumTest {
enum Weather {Sunny, Rainy, Snowy, Overcast, Stormy};
public static void main (String[] args) {
Scanner scan = new scanner(System.in);
String userinput = nextLine;
if (userinput.equalsIgnoreCase(Weather.all) // I wish for this to occur if any of the Weather enums are entered.
System.out.println ("Working!");
}
}
}
Well, I guess I'm a little confused, maybe try something like this?