How to swap two String values without using a
third variable?

Answer Posted / badar awan

public class B
{
public static void main(String [] args)
{
String a = "Badar" ;
String b ="Asad";
a= a+b;
b = a.substring(0,(a.length()-b.length()));
a = a.substring(b.length(),(a.length()));
System.out.println("a == "+ a);
System.out.println("b == "+ b);
}
}

Is This Answer Correct ?    9 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is the BAM? where we can use it in BizTalk server?

1358


Write a program to find duplicate number from array in minimum time complexity.

646


How will you prove that java swing is multithreaded?

1704


Give examples of macro quoting function?

1556


hi, all this is shoba m.c.a . i have learned abap but no oppurtunities right now as fresher , right now i want to learn any course on demand any one pls suggest me good course and institute in hyderabad

1398






Suppose server object is not loaded into the memory, and the client request for it , what will happen?

2175


what are the advantages of sap on other software ?

1734


Explain what is OOPS and its concepts?

586


What is the use of sas software? Is sas and sap are different?

1024


when will triggars the at new event in abap and web dybn pro?

1494


How many forms can you create in a Visual Basic 6 Standard EXE project? Is there any limit on that?

1542


iam confused among testing ,.net and java. can anybody help me.

1582


write the a cl program with the following specification A. Accept 2 parameters-date and date type B. if date type is J then convert date to *MDY format C. if date type is M convert date to *JUL format 4.send a program message with the value of converted date Please explain for each with coding?

2189


Difference between delegates and Events?

1719


Q2. A memory location has physical address D5687h. Compute: a. The offset address if the segment number is D445h. b. The segment number if the offset address is B577h.

1635