Answer the question
In order to leave comments, you need to log in
Why is keyboard input not being validated?
package com.lol;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String yep = "shop";
System.out.print(">");
String com = in.next();
if(com == yep){
System.out.print("Okay, it's work!");
}else if(com != yep){
System.out.print("Hey!");
}else{
System.out.print("meh...");
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question