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
Write a pseudo code to evaluate a number to any base given (2...16) based on the input. Number greater than 9 should be given as A-F for 10-15.
How to change the color of a cell or a row in a datagrid on mouse hover using javascript/.net
what are stubs related to foxpro?
differences between qtp10.0 and 11.0 ?
HOW TO FIND NUMBER OF TWOS IN N!(N FACTORIAL)??
Is there any standard procedure to test the application as a whole? Or How can I test complete application right from the requirement gathering?
Write a program to swap the content of two variables without using a third variable.
What is SOLID Principle in Programming Language?
write a query that returns one row for each department and the number of employees in that department. Given two tables EMPLOYEE and DEPARTMENT, where there can be multiple employees per department.
what are other resources are needed for this mantis?
hi i am jyoti i have done sap training in sd and master degree in economics have 2 year exp as enduser in (gdms)and 1 year as sd consultant.as contract basis now what i can do for getting job in it industry
they asked me about srs (software requirement specifcation)? how can i get anydocumentation about srs & other documnts infomation like bdd, in testing? its urgent?
details description on this mantis? who is founder of this mantis?
what is d main diff between the java and .net framework
5. How do you round the addition or subtraction of two numbers in assembler?