Difference between a normal class and java bean


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Difference between a normal class and java bean

  1. #1
    Join Date
    Nov 2003
    Posts
    8

    Difference between a normal class and java bean

    Can anyone explain the difference between a normal java class and Java bean?
    Viren

  2. #2
    Join Date
    Feb 2004
    Posts
    808
    beans typically implement everything necessary for a particular functionality, and have no external dependencies. They live in a container and must be able to co-exist peacably (no fighting over database connections or credit card details)

    typically they are used in enterprise applications to give some form of scalability.. to up the power of your application you just buy another computer, run the bean container on it, and let it put some beans in..

    there isnt actually a lot of difference, because a class is supposed to be unitary and independent.. its just with beans, that they have to be. Beans also have well defined sematics for their recycling, and in enterpriuse apps, anything that is well defined and serving 100000 cuustomers is a Good Thing(TM)
    The 6th edict:
    "A thing of reference thing can hold either a null thing or a thing to any thing whose thing is assignment compatible with the thing of the thing" - ArchAngel, www.dictionary.com et al.
    JAR tutorial GridBag tutorial Inherited Shapes Inheritance? String.split(); FTP?

  3. #3
    Join Date
    May 2004
    Posts
    26
    Essentially there is no difference. Bean is just another Java class.

    The minimum requirements for a class to be considered a Bean are:
    1) It should implement the Serializable interface.
    2) It should have public 'get' and 'set' methods that expose it's member variables.

    All beans are classes. But all classes are not beans.

    I assume you are talking about simple Java beans and not EJBs.

  4. #4
    Join Date
    Dec 2002
    Posts
    83
    What Atlas said. Cjard looks to be getting into EJBs, and those things are scary!

    There is a third requirement for simple Java beans.
    3) It must implement a no argument (empty) constructor.
    -- Steven

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
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

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