i want to make a class same as String(immutable, which can be initialized like String="abc"; // normally we do String a = new String("abc"); Kindly help me out
As for making objects immutable, just don't create any methods that can modify your data, and keep the data private. If you make it protected or use default access, other classes are still able to change the object.
Post by:autobot
That new kid is a freak. Show him this tiny ad:
a bit of art, as a gift, the permaculture playing cards