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
what are the things i had to say in personal introduction in hr round mail me to prasanna.1867@rediff.com
What are the tasks performed by a Team Lead
Is the IT field raise again? What is the position of IT after 4 years?
How do i find out the number of parameters passed into function?
Explain three modes in which files can be accessed from python program
sample code for data transfer between two r/2 systems and r/3 systems?
i want to improve my english vocab for racking campus written exam plz tell me best book for prepration......
When you deliver your C++ headers and C++ library of a class (what all can you change in the class so that application using your class does not need to recompile the code)
can we allocate memory for interface? if no then why?
What is %Type,%Rowtype?
hii I inntrested abt scjp certification but i dont knw abt scjp plz send details abt scjp exam and syllabus.
purpose of abstraction and interface
Do not use more than 3 nested IF. Use Evaluate statement in case of more IF required. Please give a detail explantion besides readability and clarity for Evaluate stmt.
Given an array of size n. It contains numbers in the range 1 to n. Each number is present at least once except for 2 numbers. Find the missing numbers.
I am looking for selenium RC online Training in chennai. can any one tell me the best institute