I would like to write the result of any calculation on the same line where the user enters the input (scanner).
For a better understanding of my question - Code example:
Scanner scanner = new Scanner(System.in);
int num1 = scanner.nextInt(); // num = 1
String op = scanner.next(); // operator = + // I know this line is being ignored.
// It's just to keep a line of reasoning.
int num2 = scanner.nextInt(); // num = 2
System.out.print(" = " + num1+num2);
Output from IDE:
1 + 2
= 3
Desired output:
1 + 2 = 3