write a code in jsp to swap two numbers?

Answer Posted / rakesh.fanu

class SwapingTest
{
public static void main(String xx[])
{
int a,b,temp;
a=10;
b=20;
System.out.println("Before Swaping :-");
System.out.println("Value a is "+a);
System.out.println("Value b is "+b);
temp=b;
b=a;
a=temp;
System.out.println("After Swaping :-");
System.out.println("Value a is "+a);
System.out.println("Value b is "+b);
}
}

Is This Answer Correct ?    11 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why sun introduce concept of anonymous class? What is need and real life use of anonymous class

1768


What are the new features about Java se 8 ?

515


What java systems libraries and methods are available for me to use?

448


In a barber shop there are 2 doors. customer come in 1 door, leave in other. minimum # of chairs. barber spend his life in cutting. always barber can cut 1 customer. few chairs in the shop. if barber busy customer waits, if chairs full, customer leave. if no customer, barber sleeps. treat barber and customer as 2 threads. you can use Semaphore class with arrive and depart and count as parameter.

1691


What are tags in java?

484






What do you understand by casting in java language? What are the types of casting?

438


How do I open my java console?

493


What does jpa mean?

494


Why bean class is used in java?

443


What is the difference between the boolean & operator and the && operator?

519


there are 67 seats in train . there are only 5 seats in a row and in last row there are only 2 seats. One person can reseve only 5 seat at a time. If person reserving seat , the care is atken that he may get all in row. if seats are not available in row then the arrangement is so that person group get nearby seats. the following class is given public class seat { char name; int seat; boolean isSeatempty } 1.Draw require class digram and object diagram. 2.Write function seatallot(int noofperson) to allocate seat with seat nuber printed for the each name.

3441


Does netbeans need jdk?

469


What is the difference between a while statement and a do statement?

488


What is the difference between deep copy and shallow copy in java

549


What is the point of lambda expressions?

474