"if" statement only allows to put numbers in it. Is there a way to make it read letters? I'm only in my fifth lesson of Java (I study in a uni and the teacher is very slow but I want to learn things fast)
for example.
import java.util.Scanner;
public class Java {
public static void main (String [] args) {
Scanner scan = new Scanner(System.in);
int answer1;
System.out.println("Do you like Java?");
answer1 = scan.nextInt();
if (answer1 == yes)
System.out.println("Cool ~");
else
System.out.println("Ehh...");
}
}
I want to put "yes" instead of the number 5. So if the user types "yes" it will print "correct".
P.S. I didn't find a clear answer to that in the search engine. It's not a duplicated thread as I'm trying to find a clear answer to that. I need a detailed explanation about it. I'm still a beginner, using those "high tech java words" won't help me.