Content deleted Content added
No edit summary |
|||
Line 15:
Because these requirements are largely expressed as conventions rather than by implementing [[interface (computer science)|interfaces]], some developers view Java Beans as [[Plain Old Java Object|Plain Old Java Objects]] that follow certain naming conventions. However, this view is misleading for Java Beans that support event handling, because the method conventions and associated support classes for event handling are fairly intricate, and require the use of specific base classes and interfaces.
== JavaBean Example ==
public class PersonBean {
private String name;
private int age;<BR>
public void setName(String n) {
this.name = n;
}<BR>
public void setAge(int a) {
this.age = a;
}<BR>
public String getName() { return this.name; }
public String getAge() { return this.age; }
}
PersonBean person = new PersonBean();
person.setName("Bobo");
System.out.println(person.getName());
== See also ==
|