do
{
try
{
q.enque();
}
catch(MyException e)
{
System.out.println(e);
}
System.out.println("Do u want to add more elements?IF Yes then press y");
choice=S.nextLine();
}while(choice=="Y"&&choice =="Y");
Printable View
do
{
try
{
q.enque();
}
catch(MyException e)
{
System.out.println(e);
}
System.out.println("Do u want to add more elements?IF Yes then press y");
choice=S.nextLine();
}while(choice=="Y"&&choice =="Y");
Don't compare two Strings for equality with the == operator; Java is not Basic. Use the equals( ... ) method instead and read the API documentation for the String class (and read some elementary tutorials to find out how comparing two objects work).
kind regards,
Jos