Hi rahul aditya,
Welcome to CodeRanch!
Please
UseCodeTags.
Secondly, your class Swap does not contain any members and methods, so why are you creating an object of it (that too, at the end of main method)?
Now, coming to your point, before you write the code, take a pencil and paper, and try to understand the flow of swapping (without temporary variable).
Hint : you are doing a=b in your code. At that very instance, value of a is gone. All you have is 2 variables containing value of b, and further code is useless from swapping perspective.
I hope this helps.
Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)