How to take input in Java?

DWQA QuestionsCategory: QuestionsHow to take input in Java?
1 Answers
Editor Staff answered 4 weeks ago

“Scanner in = new Scanner(System.in);
System.out.print(“”Please enter hour 1: “”);
int hour1 = in.nextInt();
System.out.print(“”Please enter hour 2: “”);
int hour2 = in.nextInt();
System.out.print(“”Please enter minute 1: “”);
int min1 = in.nextInt();
System.out.print(“”Please enter minute 2: “”);
int min2 = in.nextInt();”