Logo F2FInterview

Beans Interview Questions

Q   |   QA

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.

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.

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.

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.

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.

In order to link this F2FInterview's page as Reference on your website or Blog, click on below text area and pres (CTRL-C) to copy the code in clipboard or right click then copy the following lines after that paste into your website or Blog.

Get Reference Link To This Page: (copy below code by (CTRL-C) and paste into your website or Blog)
HTML Rendering of above code: