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
in IT trend mantis meant what? how to know mantis in IT trends? detail description about mantis?
how does database connection using ADO.NET?
Given an array of size n. It contains numbers in the range 1 to n. Each number is present at least once except for 1 number. Find the missing number
Which method protects back button to retrieve old value from previous page in Struts.
WS-NUM PIC S9(05)V(02) SIGN TRAILING SEPARATE MOVE '0050000+' TO WS-NUM The value stored is 00500,00+ MOVE '0050000-' TO WS-NUM Then what is the value will be stored in WS-NUM? Am getting '-00500,00'.....>>> What should I declare to WS-NUM so that I can get correct values for both + & - signs.
Code for display the images from drive using vb 6.0?
What is the use of sas software? Is sas and sap are different?
what is meaning of MDM in sap?let me know that meaning
can we allocate memory for interface? if no then why?
what are the advantages of sap on other software ?
10.Define filters,binary to hexadecimal,hexadecimal to decimal?
Which CRM is better to opt, Sebiel CRM or Salesforce CRM or sap CRM? which institute is best one in hyderabad
What is the difference between CLEAR & RESET and OPEN & CLOSE OPCOEDS(USING RPG/400).wheare we can use this?can any body tell me in real time senario with example please?
how will you code the subfile which is in editing mode (multiple case subfile)?
how to add Servlet-api.jar file into eclipse 3.3.2 ?