subtraction

Creating simple Calculator in Java

Submitted by mehfuza on

Introduction

This tutorial is about creating simple calculator which performs only four operations. For creating a simple Calculator we require two JTextFields where the user can enter two numbers, four JButton for four operations namely addition, subtraction,multiplication and division, a JLabel for displaying the result.

Implementation

Step 1: Creating a class which extends JFrame because we are going to create an Application. After this we have to define the constructor of the class as follows. Super() is used to give title to the frame.