1,153 views
I think beans means components..reduce code developing time.is it correct?
i want to know how to implement and real time uses of that..
Category
edited Oct 31, 2018 | 1,153 views

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

https://docs.oracle.com/javase/tutorial/javabeans/quick/button.html

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 :

//Student.java

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

System.out.println(s.getName());

}}  
edited Sep 25, 2015