class swapper {
public static void main(String args[]) {
int a=10,b=20,temp;
System.out.println("Before swapping:
"+a+" and "+b);
temp=a;
a=b;
b=temp;
System.out.println("After swapping:
"+a+" and "+b);
}
}
OUTPUT:
C:\jdk1.7.0\bin>java
swapper
Before
swapping: 10 and 20
After swapping: 20
and 10
No comments:
Post a Comment