• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Java class and Java Bean

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the difference between java class and java bean?
 
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Java class : A java class is a class which normally has properties and methods through which these properties are modified. The class can perform some functions specific to the data in the class.

Java Bean: java bean is also a java class but its basic use is for storing the state of the class , i.e it has properties and there are setter and getter methods. This class is basically used for storing the state of the data and then retreiving the state at a later point of time. Even java bean is also a class.
java bean can be said as a class which normally does not have processing logic. It is however not illegal if the java bean contains processing logic.
regards
shekar.
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving thread to the Java In General (Beginners) forum.
This forum is supposed to be for Servlets questions only.
Mark
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think there's one more requirement in the definition of Java Bean, and that's a "default constructor" - one with no arguments.
The idea with all the get and set methods is that you can "inspect" a bean through the reflection APIs and discover all those methods. Tools like IDEs could accept a new bean they've never heard of before, figure out all the get and set methods and build a properties sheet and integrate the bean quite nicely. I don't know how much this technology caught on, but I think not near as much as the inventors hoped.
If you haven't heard of reflection, trust me it's cool, it's a bit advanced, and one day you'll have a ball with it.
You'll also hear about Enterprise Java Beans. Something else altogether, not related, very different (am I making the point) not the same thing.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic