Java Java Bean

In this tutorial you will learn about the Java Java Bean and its application with practical example.

Java Java Bean

Java Bean are classes that encapsulate many objects into a single object. It contains constructor, Getter, Setter Methods. With the help of Setter and Getter method user can set and get data. It also have zero argument constructor. Check out below code for more details.

Table Of Contents

 

Example: Let’s get understand it by an simple example.

 

#simpleBean.java: Create a java class for bean and do code as i did like below.

#testBean.java: This will be another java file from which we will set and get data from our bean class. Check below code.

Output: The output of above code will look like below image.

12

So this was the overview of bean class, we will use in next article of jsp:useBean action tag.

In this tutorial we have learn about the Java Java Bean and its application with practical example. I hope you will like this tutorial.