System.out.println ("Do you want to use the software again? yes or no?");
Scanner s=new Scanner(System.in);
String a=s.nextLine();
if (a=="no") {System.exit(0);}}
}}
I know that it should work. But it doesn't work. Even if I type no at the end, the program just restarts. Note that if I replace the string a with an integer a, for example by int a=s.nextInt(); if (a==1) {System.exit(0);}}}}, it works if I enter 1 at the end of the program and it quits like I want it to. So that means there's some problem with my string method. Could anyone clarify this?
This post has been edited by Atli: 09 October 2012 - 04:20 AM
Reason for edit:: Replaced the bold tags with [code] and [il].

New Topic/Question
Reply


MultiQuote




|