package Lessons;
import java.util.Scanner;
public class Math {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.
You need to call in.nextLine()
right after the line where you call in.nextInt()
The reason is that just asking for the next integer doesn't consume the entire line from the input, and so you need skip ahead to the next new-line character in the input by calling in.nextLine()
.
int a2 = s.nextInt();
s.nextLine();
This pretty much has to be done each time you need to get a new line after calling a method that doesn't consume the entire line, such as when you call nextBoolean()
etc.