How to swap values between two variables without using a
third variable?
Answer Posted / shyam sundar baishya
How to swap two String values without using a
third variable?
In 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 ? | 6 Yes | 0 No |
Post New Answer View All Answers
write a sql qwery which include joining of two tables 4 marks mainframe
what is the use MDM(Master Data Management)and meaning
Tell me the jobs for the MCA Fresher in delhi, Noida..
details description on this mantis? who is founder of this mantis?
what is session state?
What is SOLID Principle in Programming Language?
Q1.Write a C program which asks the user for a number between 1 to 9 and shows the number. If the user inputs a number out of the specified range, the program should show an error and prompt the user for a valid input.
Busy waiting is a method whereas a taskwaits for a given event by continiously checking for an event to occur. What is the main problem with this approach
How to set fixed width in particular
1.what is the vesition managment.
what is radio button? Plz show code this! how will select radio buttons to go next window Forms? Supose o radio button1 o radio button2 o radio button3 o radio button4 how will coding this? Plz explain this!
How do you initialize a static member of a class with return value of some function?
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 want to pass .pdf files as OlE Object to crystal report through VB6. Please any one guid me...
can any one suggestion me present which course(except java,.net) has huge demand in the market?