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

in cobol,wat is the difference in using 'set index in occurs clause' ....and 'occurs depending-on clause'

2291


< DL Compact > tag is used for

1997


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

2279


How to call dll API sub routine in VB Form.

2398


Difference of Console, web & windows applications?

2273


Explain with examples any 2 features of OOPS.

1176


WHAT IS THE MEANING OF CONSTANT ...EXEEDS LENGTH LIMIT WHILE COPYING FROM PS FILE TO KSDS

2132


What is the use of Differ interface check box in Ship confirm?

2442


how do i add a column dynamically in a table by using java application?

2086


how do i create my own exception class which will restrict IO exception?

2792


what is programmable BIST in today ic design

2197


What is SOLID Principle in Programming Language?

1293


differences between qtp10.0 and 11.0 ?

2359


Explain three modes in which files can be accessed from python program

1819


What is ur porject Architecture? If anyone ask what i have to specify here..

2011