Java - Programming Language
This course covers the basics of programming in Java. Work your way through the videos/articles and I'll teach you everything you need to know to start your programming journey!
I'm starting a coding bootcamp
Want to learn web development in a fun and gamefied environment? Head over to and see what I'm working on!

Better Calculator

Lesson 17
Author : Mike Dane
Last Updated : October, 2017


Copy// import java.util.Scanner;
Scanner keyboardInput = new Scanner(;

System.out.print("Enter num1: ");
int num1 = keyboardInput.nextDouble(); // .nextDouble(), .nextInt()

System.out.print("Enter Operator: ");
String op = keyboardInput.nextLine();

System.out.print("Enter num2: ");
int num2 = keyboardInput.nextDouble();

     System.out.println(num1 + num2);
} else if(op.equals("-")){
     System.out.println(num1 - num2);
} else if(op.equals("/")){
     System.out.println(num1 / num2);
} else if(op.equals("*")){
     System.out.println(num1 * num2);
} else {
     System.out.println("Invalid Operator");

System.out.println(num1 + num2);