Java Program to Add Two Numbers Without Using Third Variable

In this tutorial, I will explain how to write a Java program to add two numbers without using the third variable.
In this program, I have declared two variables as X and Y with some values, after that, used plus operator to save both values and put the result in the first variable.

Java program to add two numbers without using third variable

Copy the below Java program and execute it with the help of Java compiler to see the output of below program.

At the end of this tutorial, I have shared the real-time output.

Program Output

Sum of two numbers: 25

Recommended Posts:


Prem Tiwari

An engineer by profession and a passionate blogger by heart. Founder of FreeWebMentor.com (A Programming blog for beginners), Tech Speaker at various forums. A part from this he is an open source enthusiast, WordPress Lover, Blogger, SEO, and Growth Strategic.

Article Tags: , , , ,

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.

Solved Programs