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
is it possible to learn sap from book without any tutorial. if yes please mention the beginner,s book of sap and also make your valuable advice for self study of sap .
How to create a new dataset only duplicate observations in proc sort procedure?
what is dot net framework
Plz sent me in .net 2.0 interview Question & answers?
Difference between delegates and Events?
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
Delta 5 weight scale not connect with oracle application what i can do?
In OB52 , How to define two open posting period, Like only 5 and 8 posting should be open.. should not open 6 and 7..period..
Hi I am Rathnam, How To Remove the duplicates with out using remove duplicate stage in the datastage
what is the difference between read the data from table and infotype
10.Define filters,binary to hexadecimal,hexadecimal to decimal?
Display names and numbers of employees who have 5 years or more experience and salary less than Rs.15000 using array of structures (name, number, experience and salary)
5. How do you round the addition or subtraction of two numbers in assembler?
Write a shell program to test whether a given year is leap year or not ?
why we use mantis? what u mean mantis in IT trends? addvantages of mantis?