This question already has an answer here:
- How do I compare strings in Java? 23 answers
Can anybody see why this is not working? (answer is string)
System.out.print("Do you have any other costs (yes/no)? :");
answer=keyboard.next();
if (answer=="yes")
{
System.out.print("How much for miscellaneouos costs? : $");
costMiscellaneous=keyboard.nextDouble();
}
else
costMiscellaneous=0;
Aucun commentaire:
Enregistrer un commentaire