DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2
  1. #1
    Satish Guest

    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



  2. #2
    prasad Guest

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.