MCPcopy Index your code
hub / github.com/BruceEckel/OnJava8-Examples / main

Method main

strings/BetterRead.java:8–25  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

6
7public class BetterRead {
8 public static void main(String[] args) {
9 Scanner stdin = new Scanner(SimpleRead.input);
10 System.out.println("What is your name?");
11 String name = stdin.nextLine();
12 System.out.println(name);
13 System.out.println(
14 "How old are you? What is your favorite double?");
15 System.out.println("(input: <age> <double>)");
16 int age = stdin.nextInt();
17 double favorite = stdin.nextDouble();
18 System.out.println(age);
19 System.out.println(favorite);
20 System.out.format("Hi %s.%n", name);
21 System.out.format("In 5 years you will be %d.%n",
22 age + 5);
23 System.out.format("My favorite double is %f.",
24 favorite / 2);
25 }
26}
27/* Output:
28What is your name?

Callers

nothing calls this directly

Calls 1

formatMethod · 0.45

Tested by

no test coverage detected