if (kirill.equals(kirill2)){
kirill
is the Scanner
object, not the string. Try something like this:
Scanner kirill = new Scanner(System.in);
String userInput = kirill.next();
if (userInput.equals("Java")){
...
Also, note that your code will print “yes” if the user types “Java is a programming langauge.” If you only want it to validate with just “Java,” replace next
with nextLine
.
solved Scanner not working? [closed]