/* Conditional2.java CIS 160 David G. Klick 2004-09-17 Demonstrates the conditional operator ?: */ import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; public class Conditional2 { public static void main(String[] args) throws IOException { BufferedReader kbd = new BufferedReader( new InputStreamReader(System.in)); int numChildren; System.out.print("Please enter number of children: "); numChildren = Integer.parseInt(kbd.readLine()); System.out.println("You have " + numChildren + (numChildren == 1 ? " child" : " children")); } }