Java Technology Hub
Home
Java Topics
Interview Q
SCJP/OCJP
B.Tech CSIT Lab
Core Java Programs
Interview Exp
Gadgets
Monday, 23 November 2015
Swapping two numbers using third variable
Swapping two numbers using third variable
public class
Swapping {
public static void
main(
String
[] arg){
int
a=
10
,b=
20
,c;
c=a;
a=b;
b=c;
System
.out.println(
"a value is : "
+a+
" b value is :"
+b);
}
}
Output:
a value is :
20
b value is :
10
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment