How to swap two String values without using a
third variable?
Answer Posted / shyambaishya
Using Java:
===========
String s1 = "Shyam Sundar Baishya" ;
String s2 ="Dilip Kumar";
System.out.println("Before swapping ............");
System.out.println("s3 == "+s1);
System.out.println("s4 == "+s2);
s1= s1+s2;
System.out.println("....................");
System.out.println("After swapping ............");
s2 = s1.substring(0,(s1.length()-s2.length()));
s1 = s1.substring(s2.length(),(s1.length()));
System.out.println("s3 == "+ s1);
System.out.println("s4 == "+ s2);
Is This Answer Correct ? | 49 Yes | 10 No |
Post New Answer View All Answers
I have try to write a record in a TDQ from a fle.... what are the steps to do... can anybody plz come with a solution
Explain what is OOPS and its concepts?
Find out the roles which gives access to all tables in SAP? Thanks in advance.
there are N number of matchboxes numbered 1...N.each matchbox contain various number of stick.Two player can alternatevely pick some amount of stick from the higest stick containing box . The player is condidered win if there is no stick after his move.Find the final move so that the move player win. Note:In case the number of stick is equal ,pick the stick from the higest numbered box. eg: 3 box contain stick as:1,1,1. if u take 1 stick from 3rd numbred box you will any how win the match.
WHat is execution in manual testing and when will we start execution and what language we use in execution
5. How do you round the addition or subtraction of two numbers in assembler?
write algo for cobol program whichuse three flat file to extract some specific information 8 marks mainframe
How can we develop a multi-tier application in Java?
what is meaning of MDM in sap?let me know that meaning
In an customer exit (include Z) program, only the last record is getting fetched. The exit is getting called after pressing save button. What to write for fetching the first record ? Before saved to a SAP table how can i call all these records in an itab in the exit ?
how to remove header and footer in jcl using sort utility
SAS question: I have 50 fils a1,a2,...,a50. the primary key is upc. then if i want to merge all 50 files, the code is as follows, data test; merge a1 ... a50; by upc; run; we know that writing all 50 files name is time consuming, is there any standard format of this code?
My Qualification is MCA.My interview is on 5th may.They may ask q as------AS u r MCA...Why u r not tring anywhere else? What can be the ans?
Find out the list of roles which gives access to GUI activities? thanks in advance
Write a shell program where you enter a number which corresponds to K.M. Find out the corresponding values in m, cm, inches, and feet. Hints:- 1 k.m= 1000 m 1 m= 100 cm 1 inches= 2.54 cm. 1 feet= 12 inches