This is simple java programming tutorial . In this section you will learn how to calculate the sum of three numbers by using three static variables.
Calculate the Sum of Three Numbers
This is simple java programming tutorial . In this section you will learn how to calculate the sum of three numbers by using three static variables.
Description of this program:
In this section we will see how to calculate three integer number . First
of all define class name "StaticSum". For this we have defined
three static variables of type int. To assign the value of the numbers
define a method main. Remember we are overloading the main method. This method
will take three arguments. The values will be added in the Addition method
which we have declared in our program. Now call the main method. To get the
values of the three numbers call the overloaded method main() inside
main() method. To add those values call the Addition method which will
return the integer value and the value will be displayed to the user by using
the println() method of the System class.
Here is the code of this program
class StaticSum
|