This is a simple Java Oriented language program. If you are newbie in Java programming then our tutorial and example are helpful for understanding Java programming in the simplest way. Here we will learn how to swap or exchange the number to each other. First of all we have to create a class "Swap". Now, we use the Integer.parseInt(args[o]) and Integer.parseInt(args) methods for getting the integer type values in command line. Use a temporary variable z of type integer that will help us to swap the numbers Assign the value of x to z variable, now assign the value of y to the variable x. Lastly assign the value of z to variable y. Now we get the values has been interchanged. To display the values on the command prompt use println() method and the swapped values will be displayed.
Here is the code of this program
Rs. 20,000 US$ 300
Today: Rs. 10,000 US$150
Course Duration: 30 hrs
Posted on: June 25, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles