Java Four Calculation Double Number

Java Four Calculation Double Number

This tutorial describe how to do four calculation (addition, substraction, multiplication and division) in java using a simple example that can be created and run by Notepad, Geany, Sublime Text, Eclipse , Netbean …

Code Tested on :

  • Oracle JDK 8
  • Sublime Text 3
  • Windows 7
  • AMD A4 quadcore with 4GB of RAM
  • Compiling using command line with command prompt

Java Four Calculation Double Screen shot

Java Four Calculation Double Number Script

Create a file called using code below
and run in Command promt

java MathFour

Full Code

Created By Sanjay
Difficulty  : Beginner Level
Description : It will take two input and and output 4 result
addition, substraction, multiplication and division
class MathFour{
public static void main(String args[]) throws Exception {
double a,b;
double add,sub,multi,div;
InputStreamReader is=new InputStreamReader(;
BufferedReader x=new BufferedReader(is);
System.out.println("Enter First No. : ");
System.out.println("Enter Second No. : ");
System.out.println("Addition : "+ add);
System.out.println("Substration : "+ sub);
System.out.println("Multiplication : "+ multi);
System.out.println("Division : "+ div);

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Do you have any Query / Suggestion