Java Java Bean

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.


Example: Let’s get understand it by an simple example. Create a java class for bean and do code as i did like below. 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.


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