0

why to make a contructor and assign a value? Isint that same as just assigning a value....???

31st Aug 2016, 5:39 AM
Siddharth J Namboodiri
Siddharth J Namboodiri - avatar
2 Antworten
0
If you assign a value outside the constructor, you are assigning a static value that all instances of that class share. Assigning it inside gives each object it's own value to be used independently of the other objects.
31st Aug 2016, 5:43 AM
James
James - avatar
0
ohh got it.... thanx alot...
31st Aug 2016, 5:45 AM
Siddharth J Namboodiri
Siddharth J Namboodiri - avatar