How to swap two String values without using a
third variable?
Answer Posted / bharat
import java.util.Scanner;
public class Swap {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int a, b;
System.out.println("Enter a and b");
Scanner in = new Scanner(System.in);
a = in.nextInt();
b = in.nextInt();
System.out.println("Befor Swapinng :" + "a : " + a + "\t" + "b :" + b);
b = a + b;
a = b - a;
b = b - a;
System.out.println("a : " + a + "\t" + "b :" + b);
}
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Given a Binary Search Tree, write a program to print the kth smallest element without using any static/global variable. You can?t pass the value k to any function also.
Write a program to swap the content of two variables without using a third variable.
what is dot net framework
hi this is uday i want prepare for nic exam if any one have previous question papers please send me or atlest guide me how to prepare my ID is udaykiran4u@in.com
How to call dll API sub routine in VB Form.
How to connect to ms word wit VB ojective is to prepare s/w to generate question paper , selects questions randomly from the ms access , database
in teradata level primary in table level allows duplicates why?
Tag for turning an image into a hyperlink is
how to generate dsnless connectivity in j2ee
how to hide prompts
how can we implement locks in plsql?
can u send some model papers how computer awareness questions are asked in goverment jobs(oriental insurance)to my mail id me.priyankapadma@rediff.com
why not instantiating servet using new operator?
they asked me about srs (software requirement specifcation)? how can i get anydocumentation about srs & other documnts infomation like bdd, in testing? its urgent?
Hi All, Can any one please send me the difference between informatica 7i and 8i versions, Thanks in advance. vinod