This example of Java programming will teach you the coding for determining the largest number amongst three.
This example of Java programming will teach you the coding for determining the largest number amongst three.First check if "x>y". If this satisfies then check whether x>z or not. Again if this satisfies then write in the system class that "x is greater". Again the term "else" comes when "x" is not greater than "z". So check again, if "z" is greater than "y" or not. If this satisfies then type in the system class as "z is greater" otherwise (in the else condition) "y" is greater. Now check whether "y" is greater than "z" or not.
If "x" is not greater than "y" as per the first condition, then the condition "else" comes and now you have to check if "y>z" or not. If this satisfies then the output comes as "y is greater".
Don't get confuse and analyze every condition one by one and follow this example.
Here is the code of program:
class largernumber{
|
Ads