note that
if (a.equals ("n") || a.equals("N"))
{CPUcolor() ;}
System.out.println ("I am "+s) ;
it should be:
if (a.equals ("n") || a.equals("N"))
{CPUcolor() ;}
else
{System.out.println ("I am "+s) ;}
, , Yes ( , No, , , - , .)
, ( ) : else tail-recursive, . , , , No , fooobar.com/questions/1740540/... Exception
public static String CPUcolor ()
{
while (true) {
System.out.println ("What color am I?") ;
String s = getIns() ;
System.out.println ("are you sure I'm "+s+"? (Y/N)") ;
String a = getIns() ;
while (!((a.equals ("y")) || (a.equals ("Y")) || (a.equals ("n")) || (a.equals ("N"))))
{
System.out.println ("try again") ;
a = getIns () ;
}
if (a.equals ("y") || a.equals("Y")) {
System.out.println ("I am "+s) ;
return s ;
}
}
}