Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

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 .

1994


How to create a new dataset only duplicate observations in proc sort procedure?

2019


what is dot net framework

2826


Plz sent me in .net 2.0 interview Question & answers?

2126


Difference between delegates and Events?

2182


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

2471


Delta 5 weight scale not connect with oracle application what i can do?

2334


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..

1465


Hi I am Rathnam, How To Remove the duplicates with out using remove duplicate stage in the datastage

1938


what is the difference between read the data from table and infotype

2543


10.Define filters,binary to hexadecimal,hexadecimal to decimal?

2110


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)

4747


5. How do you round the addition or subtraction of two numbers in assembler?

2230


Write a shell program to test whether a given year is leap year or not ?

2685


why we use mantis? what u mean mantis in IT trends? addvantages of mantis?

2222