In my last tutorial entitle “Printing Hello Word in Java”, discuss the structure of Java programs and its parts. This tutorial will teach you on how you can sum two integers values using Java. Integer is one of the examples of Data type in Java.
Remember that there are many Data type that handles Number values and Integer can only handle whole numbers.
Sum Two Integer Value in Java steps
1.Create a new project in Netbeans and name the project on what you want to name it.
2.Insert a main method inside your Class.
3.Declare three integer variables and initialized it inside your new created main method.
- int num1=2;
- int num2=2;
- int total=0;
3.Insert the code below to calculate and display the result.
4. Run your program and the result should look like the image below.
5. Complete source code
If you have any comments or suggestion about on Sum Two Integers Value using Java, Please feel free to leave your comment below, use the contact page of this website or use my contact information.
Email: [email protected] | Cell. No.: 09468362375