+2 votes
I think beans means components..reduce code developing time.is it correct?  And i want to know how to implement and real time uses of that..
asked Sep 24, 2015 in Computer Science - IT by gypsiii (353 points)
edited Nov 21, 2015 by slow_learner | 873 views

2 Answers

0 votes

A Java Bean is a software component that has been designed to be reusable in a variety of different environments. There is no restriction on the capability of a Bean. It may 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. blah blahhhhh..
Where is bean ?

Wikipedia - JavaBeans are classes that encapsulate many objects into a single object (the bean).

A Button is a Bean


A Java Bean is a java class that should follow following conventions:

  • It should have a no-arg constructor.
  • It should be Serializable.
  • It should provide methods to set and get the values of the properties, known as getter and setter methods.

A simple example of bean :

package goeshere;  
public class Student implements java.io.Serializable{  
private int id;  
private String name;  
public Student(){}  
public void setId(int id){this.id=id;}  
public int getId(){return id;}  
public void setName(String name){this.name=name;}  
public String getName(){return name;}  

Accessing a Bean :

package goeshere;  
public class Test{  
public static void main(String args[]){  
Student s=new Student();//object is created  
s.setName("Gypsii");//setting value to the object  
answered Sep 25, 2015 by slow_learner (1,492 points)
edited Sep 25, 2015 by slow_learner
0 votes

Java beans are reusable software components that separate the business logic from the presentation logic. Java bean are simple java classes that follow certain specifications to develop dynamic content. They are used to create dynamic web pages.JavaBeans components  can be used to give World Wide Web pages interactive capabilities such as computing interest rates . It can  be implemented like:

Method Description
getPropertyName() For example, if property name is firstName, your method name would be getFirstName() to read that property. This method is called accessor.
setPropertyName() For example, if property name is firstName, your method name would be setFirstName() to write that property. This method is called mutator.
answered Jan 12, 2016 by Shikha tyagi (3 points)