// This program reads three values from the same line of input. // Barry Cornelius, 2 June 2000 import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; import java.util.StringTokenizer; public class OneLine { public static void main(final String[] pArgs) throws IOException { final BufferedReader tKeyboard = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Type age, height, and number of children"); System.out.println("Separate the values by at least one space"); final String tLine = tKeyboard.readLine(); final StringTokenizer tTokens = new StringTokenizer(tLine); final String tAgeString = tTokens.nextToken(); final int tAge = Integer.parseInt(tAgeString); final String tHeightString = tTokens.nextToken(); final double tHeight = Double.parseDouble(tHeightString); final String tNumberOfChildrenString = tTokens.nextToken(); final int tNumberOfChildren = Integer.parseInt(tNumberOfChildrenString); System.out.println("Age is " + tAge + " and height is " + tHeight); System.out.println("Number of children is " + tNumberOfChildren); } }