import java.util.Scanner; public class Bool2String { public static String toString( boolean x ) { /* ------------------------------------------------------- Signal to students that we are using our own method ! ------------------------------------------------------- */ System.out.println("*** You called BooleanIO's toString( )"); if ( x == true ) return "true"; else return "false"; } public static void main(String[] args) { boolean x = true; boolean y = false; String s; s = toString(x); // Convert boolean value to a string repr // *** Try replacing this method call // *** with Java's Boolean.toString( ) System.out.println("String for 'true' boolean value = " + s + "\n"); s = toString(y); // Convert boolean value to a string repr // *** Try replacing this method call // *** with Java's Boolean.toString( ) System.out.println("String for 'false' boolean value = " + s + "\n"); } }