/**** * * This program inputs a numeric value from stdin and performs some * computations with the input. The compuations are performed on the input * value in both string and numeric forms. * * The program has undefined behavor if the supplied input is not an integer of * at least three digits. * */ import java.io.*; public class lab1 { public static void main(String[] args) throws java.io.IOException { BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); String line; System.out.print("Input a number and press the Enter or Return key: "); line = stdin.readLine(); System.out.println("\nThe number has " + line.length() + " digits"); System.out.println("The third digit of the number is " + line.charAt(2)); System.out.println("The number times 100 is " + line + "00"); System.out.println("The number plus 100 is " + (Integer.parseInt(line) + 100)); } }