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
3. What is the difference between testing and Quality Assurance?
Definition of Singleton Class? what is the Purpose of it? what is the advantage?
in IT trend mantis meant what? how to know mantis in IT trends? detail description about mantis?
how to data grid use in data bind?
what is adodb??y it is used for connection of V.B and access??what is ado?dao?
how do u handle table control inbdc explain the process in steps iwant the answer in urgent please forward this even i know how to explain there
in network security,how we identified threat?some one say we found threat according to it's signature,but how we get signature or pattern of the virus?
what are the things i had to say in personal introduction in hr round mail me to prasanna.1867@rediff.com
what do u mean by tagging
what is d main diff between the java and .net framework
Difference between views and index in sas programming
what is woransient key word? how it is used in java
How to change the color of a cell or a row in a datagrid on mouse hover using javascript/.net
hi i m deepak my shedule for NIC pi is 17 Apr please contact me if anybody has interview on same day or give me some idea who have faced
can any method return type may be constructor , or that method name allow