Tuesday, November 16, 2010

How to comparing two values in Java

ok after few days I am going to explain how to compare two numeric values using Java. We are simple going to find which number is the greater one. To start the program I will create a class file call Comparing. I will take two numbers as a= 20 and b= 25. To get the answer we have to find whether a=b, a>b or a<b.  To solve this problem I am going to use ELSE condition on by one. So I will apply it as if ( a=b) else if (a>b) else println b is greater than a. :)  If one of this conditions get execute you will get the print message as I given bellow in the code. So please see my notepad and command prompt screens that I upload with this post. I hope you can save your file and execute your files by giving proper command....

No comments:

Post a Comment