Java Beans

  Home  Java Programing  Java Beans


“Java Beans Interview Questions and Answers will teach us now taht JavaBeans are reusable software components for Java that can be manipulated visually in a builder tool. Practically, they are classes written in the Java programming language conforming to a particular convention. They are used to encapsulate many objects into a single object. Learn JavaBeans or preparation of JavaBeans job with the help of this Java Beans Interview Questions with Answers guide”



57 Java Beans Questions And Answers

1⟩ What is property editor in java beans?

A property editor is a tool for customizing a particular property type. Property editors are activated in the Properties window. This window determines a property's type, searches for a relevant property editor, and displays the property's current value in a relevant way.

 143 views

2⟩ Write a simple bean program?

Write the SimpleBean code. Put it in a file named SimpleBean.java, in the directory of your choice. Here's the code:

import java.awt.Color;

import java.beans.XMLDecoder;

import javax.swing.JLabel;

import java.io.Serializable;

public class SimpleBean extends JLabel

implements Serializable {

public SimpleBean() {

setText( "Hello world!" );

setOpaque( true );

setBackground( Color.RED );

setForeground( Color.YELLOW );

setVerticalAlignment( CENTER );

setHorizontalAlignment( CENTER );

}

}

 131 views

3⟩ What are externizable interface?

Use the Externalizable interface when you need complete control over your bean's serialization (for example, when writing and reading a specific file format).

To use the Externalizable interface you need to implement two methods: readExternal and writeExternal. Classes that implement Externalizable must have a no-argument constructor.

 160 views

4⟩ What is bean persistance property?

A bean has the property of persistence when its properties, fields, and state information are saved to and retrieved from storage. Component models provide a mechanism for persistence that enables the state of components to be stored in a non-volatile place for later retrieval.

 140 views

5⟩ Why do I get a NullPointerException when loading a JAR file into the BeanBox?

Usually this is because of a mistake in the JAR file being loaded. In the meantime, typical errors include:

► The MANIFEST file uses classes using the wrong file separator ("/" should be used in all platforms).

► The MANIFEST file refers to classes in a package but the actual .class files are not really in that package.

 135 views

6⟩ What kind of industry support exists for JavaBeans?

A coalition of industry leaders in component development worked with JavaSoft to create the JavaBeans specification, which was released to the Internet for public comments on September 4, 1996. The "frozen" JavaBeans specification combines the work of Apple, Borland, IBM, JustSystem, Microsoft, Netscape, Rogue Wave, SunSoft and Symantec and many, many others... We're very pleased to see the tools community swiftly embracing JavaBeans by announcing support for JavaBeans in their visual application builder tools.

 124 views

7⟩ What are the purpose of introspection?

A growing number of Java object repository sites exist on the Internet in answer to the demand for centralized deployment of applets, classes, and source code in general. Any developer who has spent time hunting through these sites for licensable Java code to incorporate into a program has undoubtedly struggled with issues of how to quickly and cleanly integrate code from one particular source into an application.

The way in which introspection is implemented provides great advantages, including:

► Portability - Everything is done in the Java platform, so you can write components once, reuse them everywhere. There are no extra specification files that need to be maintained independently from your component code. There are no platform-specific issues to contend with. Your component is not tied to one component model or one proprietary platform. You get all the advantages of the evolving Java APIs, while maintaining the portability of your components.

► Reuse - By following the JavaBeans design conventions, implementing the appropriate interfaces, and extending the appropriate classes, you provide yourcomponent with reuse potential that possibly exceeds your expectations.

 145 views

8⟩ What are Java Beans?

Java Beans are usual Java classes which adhere to certain coding conventions:

► Implements java.io.Serializable interface

► Provides no argument constructor

► Provides getter and setter methods for accessing it's properties.

 128 views

9⟩ What are the security implications for downloading Beans over the Internet?

JavaBeans does not add any security features to the Java platform. Rather, JavaBeans components have full access to the broad range of security features that are part of the Java platform. JavaBeans components can be used to build a range of different kinds of solutions from full-fledged Java desktop applications to web-based Applets.

 168 views

11⟩ Why a component architecture for the Java platform?

JavaBeans brings the extraordinary power of the Java platform to component development, offering the ideal environment for a developer who wants to extend the concept of reusable component development beyond one platform and one architecture to embrace every platform and every architecture in the industry.

 161 views

12⟩ Is JavaBeans a complete component architecture?

JavaBeans is a complete component model. It supports the standard component architecture features of properties, events, methods, and persistence. In addition, JavaBeans provides support for introspection (to allow automatic analysis of a JavaBeanscomponent) and customization (to make it easy to configure a JavaBeans component).

 120 views

13⟩ What is a Bean? Why is not a Bean an Applet?

JavaBeans components, or Beans, are reusable software components that can be manipulated visually in a builder tool. Beans can be combined to create traditional applications, or their smaller web-oriented brethren, applets. In addition, applets can be designed to work as reusable Beans.

Individual Beans will function quite differently, but typical unifying features that distinguish a Bean are:

► Introspection: enables a builder tool to analyze how a Bean works

► Customization: enables a developer to use an app builder tool to customize the appearance and behavior of a Bean

► Events: enables Beans to communicate and connect together

► Properties: enable developers to customize and program with Beans

► Persistence: enables developers to customize Beans in an app builder, and then retrieve those Beans, with customized features intact, for future use.

 165 views

14⟩ What is entity reference?

A reference to an entity that is substituted for the reference when the XML document is parsed. It can reference a predefined entity such as < or reference one that is defined in the DTD. In the XML data, the reference could be to an entity that is defined in the local subset of the DTD or to an external XML file (an external entity). The DTD can also carve out a segment of DTD specifications and give it a name so that it can be reused (included) at multiple points in the DTD by defining a parameter entity.

 136 views

15⟩ Why are component architectures useful?

Developers are turning to creating components rather than monolithic applications to free themselves from slow, expensive application development, and to build up a portable, reusable code base. This enables developers to quickly attack new market opportunities, new joint development opportunities, and new ways to sell smaller packages of software.

 126 views

16⟩ Difference between java bean and bean?

A Java Bean is a software component written in the Java programming language that conforms to the JavaBeans component specification. The JavaBeans APIs became part of the "core" Java APIs as of the 1.1 release of the JDK.

The JavaBeans specification defines a Java-based software component model that adds a number of features to the Java programming language. Some of these features include:

► introspection

► customization

► events

► properties

► persistence

Enterprise JavaBeans (EJBs) are Java-based software components that are built to comply with Java's EJB specification and run inside of an EJB container supplied by a J2EE provider. An EJB container provides distributed application functionality such as transaction support, persistence and lifecycle management for the EJBs.

 148 views

17⟩ What is the relationship between Sun s JFCs and JavaBeans?

The JFC (Java Foundation Classes) is based upon the AWT (Abstract Windowing Toolkit), which has been part of the Java platform from the beginning. JFC effectively adds a richer set of visual elements for building JavaBeans components and applications. See the JFC web site for more information.

 116 views

18⟩ What is enterprise bean provider?

An application developer who produces enterprise bean classes, remote and Interview Questions - Home interfaces, and deployment descriptor files, and packages them in an EJB JAR file.

 132 views

19⟩ What is an entity?

A distinct, individual item that can be included in an XML document by referencing it. Such an entity reference can name an entity as small as a character (for example, <, which references the less-than symbol or left angle bracket, <). An entity reference can also reference an entire document, an external entity, or a collection of DTD definitions.

 136 views