Java Program to Create a Calculator Using AWT Controls

Today in this java programming we will learn a Java Program to Create a Calculator Using AWT Controls(Abstract Window Toolkit). This will be a basic calculator with a user interface. The AWT components we will be using are Textfields, Buttons, and labels.

As we know a simple calculator requires two fields for input and one field to show the result of the operation performed on those two operands.
Let’s begin.

Example: Calculator Program in Java using AWT

Source Code:

Output: Output: Save the file with .java extension and open the command prompt on that directory and run the following code.

C:\java>javac Calculator.java
C:\java>java Calculator

You will see the following result:

Java AWT calculator

This is the end of the article Simple calculator program in java using AWT with output.
Learn more about Java Programs.