Hello.
Because I plan on doing something with Java (and because it has the only editor that doesn't throw up weird errors at me) I decided to learn it. I've watched few tutorials and decided to make a small quiz just to see what I can do with what I've already learned. The thing is , the program I have wrote is supposed to say "Yes it is correct" when the answer is "2" but it always says the opposite "Nope." I have searched through numerous forums and even the documentation, all which help, but bring me back to the same issue.
Here is my code:
import java.util.Scanner;
class first{
public static void main(String args[]){
Scanner question = new Scanner(System.in);
System.out.println("What is 1 + 1?");
question.nextDouble();
question.close();
if (question.equals("2")){
System.out.println("That is correct");
}else{
System.out.println("Nope.");
}
}
}
If anyone programs in Java and could help me with this issue it would be appreciated.
Thank you!!
Oh come on. We're trying to talk with sigs here and you rudely interrupt.
