My name is Aravindhan.A and I am with Software AG. Having a passion towards programming...striving to become a vivid programmer... :)
Monday, July 28, 2008
Aravind @ Software AG
change to Chennai....and hav just stepped into Software AG..... left out in a new world and trying to grab the walls over here...fairly interesting stuffz... to know more about Software AG.... visit softwareag
Monday, June 9, 2008
Swapping two values without a temp variable.....
Itz done by using XOR Operator...
int a = 2, b = 3;
a ^= b;
b ^= a;
a ^= b;
System.out.println("A Value : " + a + " : " + "B Value : " +b);
a^=b ---> 010(2) ^ 011(3) ---> 001(1) ---> a = 1
b^=a ---> 011(3) ^ 001(1) ---> 010(2) ---> b = 2
a^=b ---> 001(1) ^ 010(2) ---> 011(3) ---> a = 3
Try this out......
int a = 2, b = 3;
a ^= b;
b ^= a;
a ^= b;
System.out.println("A Value : " + a + " : " + "B Value : " +b);
a^=b ---> 010(2) ^ 011(3) ---> 001(1) ---> a = 1
b^=a ---> 011(3) ^ 001(1) ---> 010(2) ---> b = 2
a^=b ---> 001(1) ^ 010(2) ---> 011(3) ---> a = 3
Try this out......
Friday, May 30, 2008
How to make an Class immutable...?
Class should be declared final with all members declared as private and no setter methods....
Immutable class in the sense...the content in the Object of the class can't be changed..
Immutable class in the sense...the content in the Object of the class can't be changed..
Subscribe to:
Posts (Atom)