How to swap two String values without using a
third variable?
Answer Posted / bharat
import java.util.Scanner;
public class Swap {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int a, b;
System.out.println("Enter a and b");
Scanner in = new Scanner(System.in);
a = in.nextInt();
b = in.nextInt();
System.out.println("Befor Swapinng :" + "a : " + a + "\t" + "b :" + b);
b = a + b;
a = b - a;
b = b - a;
System.out.println("a : " + a + "\t" + "b :" + b);
}
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
hii I inntrested abt scjp certification but i dont knw abt scjp plz send details abt scjp exam and syllabus.
write algo for cobol program whichuse three flat file to extract some specific information 8 marks mainframe
what is programmable BIST in today ic design
where is available in this mantis toturials?
we create a pf with 3 fields.2 is defined as keyfields.we lock it with alcobj command.how we find out whether the file is locked or not?is it dspfd??/
in a VB application, where the data will be stored after manipulation? what is the syntax for that?
what is web service in java? have u use before.
What binary value will be internally stored for NULL for the type S9(1) COMP 3 in mainframe
what is the extension of SPDS Dynamic cluster tables?
what is the main usage of an abstract keyword?please follow the program class A { void display() { System.out.println("hai"); } void print() { } } class B extends A { void print() { System.out.println("Hello"); } } In this program i was gives the implementation of print() according to my requirements in subclass.And there is no definition in superclass then why we can use abstract keyword before a method that i want to gives definition in other classes,is any mistakes in the above usage of method?
if 3 duplicate records, by keeping one original and one duplicate record, and how to delete remaining 2 duplicates in sql server 2008
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!
I am looking for NIC Sample papers or any patern of questions/ syllabus plz, send me on hamid.khan135@yahoo.in Regard
Difference between debugging, running, executing of an application
You are given some denominations of coins in an array (int denom[])and infinite supply of all of them. Given an amount (int amount), find the minimum number of coins required to get the exact amount. What is the method called?