Find the output | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 2

Find the output

Int a=5, b=6; b = a+b-(a=b) ; System.out.println("a: "+a+" b: "+b") ;

6th May 2017, 12:02 PM
Rahul Pathak
Rahul Pathak - avatar
3 Réponses
+ 1
a : 6 b : 5
6th May 2017, 12:03 PM
Rahul Pathak
Rahul Pathak - avatar
+ 8
Error.... Btw It's a good trick ^^ Then...Let's share the other trick With you trick often worked for int and double/float type (I want to swap string and char too) another trick is....
6th May 2017, 12:10 PM
Yanothai Chaitawat
Yanothai Chaitawat - avatar
+ 8
a^=b;b^=a;a^=b; But Not worked on String in java :(
6th May 2017, 5:32 PM
Yanothai Chaitawat
Yanothai Chaitawat - avatar