import java.util.Scanner; public class L02InputExample { public static void main(String[] args) { { Scanner scanner = new Scanner(System.in); System.out.println("Enter your age: "); double age = scanner.nextDouble(); System.out.println("Enter you max heart Rate:" ); int rate = scanner.nextInt(); double fb = (rate - age) * 0.65; System.out.println("Ideal heart Rate " + fb); //scanner.close(); // If close the scanner here, will get an error below because System.in was closed } { Scanner scanner = new Scanner(System.in); System.out.println("Enter your age: "); double age = scanner.nextDouble(); System.out.println("Enter you max heart Rate:" ); int rate = scanner.nextInt(); double fb = (rate - age) * 0.65; System.out.println("Ideal heart Rate " + fb); scanner.close(); } } }