Sunday, 1 February 2015

Java Beans Interview Questions and Answers - Java Beans

21. How to create bound property in bean application?
To create the title property as a bound property for the MyBean component in the NetBeans GUI Builder, perform the following sequence of operations:
? Right-click the Bean Patterns node in the MyBean class hierarchy.
? Select Add|Property from the pop-up menu.
? Fill the New Property Pattern form as shown on the following figure and click OK.

22. What is the serializable class in java beans?
Any class is serializable as long as that class or a parent class implements the interface. Examples of serializable classes include Component, String, Date, Vector, and Hashtable.

23. How to control serialization in java beans?
Three ways to control serilization in java beans:
1.Automatic serialization, implemented by the Serializable interface. The Java serialization software serializes the entire object, except transient and static fields.
2.Customized serialization. Selectively exclude fields you do not want serialized by marking with the transient (or static) modifier.
3.Customized file format, implemented by the Externalizable interface and its two methods. Beans are written in a specific file format.

24. What is introspection properties in java beans?
Introspection is the automatic process of analyzing a bean's design patterns to reveal the bean's properties, events, and methods.

25. What are introspection API in java beans?
The JavaBeans API architecture supplies a set of classes and interfaces to provide introspection.
The BeanInfo (in the API reference documentation) interface of the java.beans package defines a set of methods that allow bean implementors to provide explicit information about their beans. By specifying BeanInfo for a bean component, a developer can hide methods, specify an icon for the toolbox, provide descriptive names for properties, define which properties are bound properties, and much more.
The getBeanInfo(beanName) (in the API reference documentation) of the Introspector (in the API reference documentation) class can be used by builder tools and other automated environments to provide detailed information about a bean. The getBeanInfo method relies on the naming conventions for the bean's properties, events, and methods. A call to getBeanInfo results in the introspection process analyzing the bean?s classes and superclasses.

26. What is bean customization?
Customization provides a means for modifying the appearance and behavior of a bean within an application builder so it meets your specific needs. There are several levels of customization available for a bean developer to allow other developers to get maximum benefit from a bean?s potential functionality.
1.By using a property editor. Each bean property has its own property editor. The NetBeans GUI Builder usually displays a bean's property editors in the Properties window. The property editor that is associated with a particular property type edits that property type.
2. By using customizers. Customizers give you complete GUI control over bean customization. Customizers are used where property editors are not practical or applicable. Unlike a property editor, which is associated with a property, a customizer is associated with a bean.

27. What is EJB container?
A container that implements the EJB component contract of the J2EE architecture. This contract specifies a runtime environment for enterprise beans that includes security, concurrency, life-cycle management, transactions, deployment, naming, and other services. An EJB container is provided by an EJB or J2EE server.

28. What is EJB context?
A vendor that supplies an EJB container. An object that allows an enterprise bean to invoke services provided by the container and to obtain the information about the caller of a client-invoked method.

29. What is EJB Home object?
An object that provides the life-cycle operations (create, remove, find) for an enterprise bean. The class for the EJB Home object is generated by the container's deployment tools. The EJB Home object implements the enterprise bean's Home interface. The client references an EJB Home object to perform life-cycle operations on an EJB object. The client uses JNDI to locate an EJB Home object.

30. What is EJB object?
An object whose class implements the enterprise bean's remote interface. A client never references an enterprise bean instance directly. A client always references an EJB object. The class of an EJB object is generated by a container's deployment tools.
More Questions & Answers :-

No comments:

Post a Comment