+ 3

What is beans in java?Why we use beans?

25th May 2019, 8:47 AM
Nidhi pandey
Nidhi pandey - avatar
5 Respuestas
+ 5
JavaBeans are classes that encapsulate many objects into a single object (the bean). All properties in java bean must be private with public getters and setter methods. These methods use to set and get the values. public class Example { private String name; private int age; public void setName(String name)  {          this.name = name;  } public String getName()  {          return name; } public void setAge(int age) { this.age = age; } public int getAge() { return age; } }
26th May 2019, 5:55 AM
A͢J
A͢J - avatar
+ 2
Java Bean is a normal Java class which has private properties with its public getter and setter method. Example:- public class Sample { private String name; public String getName() { return this.name; } public void setName(String name) { this.name = name; } } //This is bean file :)
25th May 2019, 9:28 AM
Puneet
+ 2
Tysm bhavya
25th May 2019, 11:50 AM
Nidhi pandey
Nidhi pandey - avatar
+ 2
Ty AJ
27th May 2019, 11:11 AM
Nidhi pandey
Nidhi pandey - avatar
+ 1
Tysm puneet
25th May 2019, 11:50 AM
Nidhi pandey
Nidhi pandey - avatar