Java Beans Question and Answers

1. What is a Java Bean?
 
  • A Java Bean is a software component that has been designed to be re–usable in a variety of different environments, and which can be visually manipulated in the builder tool.
  • Bean can perform a simple function, (such as checking the spelling of a document), or a complex function (such as forecasting the performance of a stock portfolio).
 
Your Name Your Email-ID
Your Answer
2. What are the advantages of Java Beans?
  Advantages of using Java Beans:
  • Portable, platform independent and stands for "write-once, run-anywhere" paradigm.
  • Bean’s properties, methods, and events are controlled when exposed to an application builder tool.
  • Bean may register to receive events from other objects and can generate events that are sent to other objects.
  • Persistence is the ability of an object to store its state, for recreation later. Beans use Java’s object serialization capabilities for persistence.
 
Your Name Your Email-ID
Your Answer
3. Compare Java Beans from Microsoft’s Active X Controls?
 
  • Java Beans is a framework for building applications out of Java components (Beans), whereas ActiveX is a framework for building components documents with ActiveX controls.
  • A Bean is very similar to an ActiveX control. However, a Bean is written in Java, and so has Java's security and cross platform nature.
  • On the other hand, ActiveX controls written in Java is also possible, however, they require a port of Microsoft's Common object Model (COM) to be used outside Microsoft windows.
 
Your Name Your Email-ID
Your Answer
4. What are the different properties of a Java Bean?
  There are five types of properties:
  • Simple property : To set a simple property, a pair of accessor, i.e. getXXX (), and mutator, i.e setXXX(), methods are employed.
  • Boolean Property : A simple property with boolean values – true or false – set in mutator method.
  • Indexed property : An indexed property when a single property can hold an array of values using public void set propertyName (propertyType[] list) method.
  • Bound property : A Bean that has a bound property generates an event when the property is changed. The event is of type propertychangeEvent and is sent to objects that previously registered an interest in receiving such notifications.
  • Constrained property : A Bean that has a constrained property generates an event when an attempt is made to change its value. The event is of type propertychangeEvent. It is sent to objects that previously registered an interest in receiving such notifications. Those other objects have the ability to veto the proposed change.
 
Your Name Your Email-ID
Your Answer
1234 Page 1 of 4