+ 1
Java input to variable
I am new to java and I want to receive input and then access the user input with a variable. For example I would liken to use a scanner and then use the usersâ input as a variable in an if statement. But It comes back saying I canât convert a scanner into a string because I was using the scanner variable. Help
5 Answers
+ 1
thank you but my if statement still is not working corrrectly
my code:
Scanner dog = Scanner(System.in);
System.out.println(âDoggos or cattos?â);
String fat = dog.next()
if (fat == âDoggosâ) {
System.out.println(âGoodâ)
}
else {
System.out.println(âNoâ)
}
+ 1
ok thank you what does the ignore case do
0
it is only printing the else statement no matter what