newbie in java here, just messing around with my project and noticed that my code output doesnt perform my else if loop. if i input the wrong answer to my quiz (A or C), there is no output and it will skip straight to my try block code.
however if i input the correct answer it will output the right code, its only if i input the wrong answer.
@SuppressWarnings("resource")
Scanner keyboardInput = new Scanner(System.in);
String answer1 = keyboardInput.nextLine();
if(answer1.equals("B")) {
correctCount++;
System.out.println("----Thats the correct answer!---- +");
}
else if(answer1.equals("A" + "C")) {
System.out.println("Wrong answer, sorry");
}
try{
doc.getDocumentElement().normalize();
System.out.println("Next Question");
NodeList q2 = doc.getElementsByTagName("q2");
Thanks for any help! and i'm aware my code may be messy aha
Aucun commentaire:
Enregistrer un commentaire