difference between bean property variable and static variables
I have a small doubt the thing is we use java bean's for persistence..I
mean all the property varibles in the bean can be made paersistant by implemanting
the seriolizable object and they could be accessed by other classes with
the latest changes in the value being persistant.I mean a variable in a bean
with some value is persistant...in the same way to achive this we could also
use static variables..The value in the static variable can also be accessed
by other classes with the latest changes on the value as it uses the same
memory location and the cahges to the variable are effected and are reflected
to all the calleses accessing it. so when static variables could be used
for persistance why do we have to use java beans?? pls reply if u know the
Re: difference between bean property variable and static variables
satish. there is a defference between the static variables and serialization.
serialization persists the state of single instance of a java object. so
as you know no two instances of a perticular class are identical they may
be in deffernt states thair variables may have different values at differnt
point of time. and with persistence you can build the same bean to the same
state even after you turn it of your system and after two days. actually
it is written back to the disk as a file. whare as in case of static variables
they are global to all instances of that class and you can not preserve the
state if you switch off your system. so the state is not persistent and you
can not serialize the statics.
so you need to deside what you want to do.
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL