Why doesn't this method print its text? (java)
Posted
by David
on Stack Overflow
See other posts from Stack Overflow
or by David
Published on 2010-04-01T00:21:21Z
Indexed on
2010/04/01
0:23 UTC
Read the original article
Hit count: 703
here's the method:
public static int chooseStrat ()
{
String[] strats = new String[1] ;
strats[0] = "0 - Blob" ;
int n ;
boolean a = false ;
while (a == false) ;
{
System.out.println ("Which strategy should the AI use?(#)") ;
printArrayS (strats) ;
n = getInt () ;
System.out.println ("you selected "+n+"."+" are you sure you want the computer to use the "+ strats[n]+ " ?(Y/N)") ;
String c = getIns () ;
while ((((!( (c.equals ("y")) || (c.equals ("Y")) )) && (!( (c.equals ("n")) || (c.equals ("N")) ) ) ))) ;
{
System.out.println ("try again") ;
c = getIns () ;
}
if ( (c.equals ("Y")) || (c.equals ("y")) )
a = true ;
}
return n ;
}
When i run this it never prints "Which strategy should the AI use?(#)" it just tries to get an entry from the keyboard. why does it do this?
© Stack Overflow or respective owner