samedi 26 septembre 2015

Simple java help for if statements [duplicate]

This question already has an answer here:

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