Introduction To JavaBean
What is JavaBean ?
JavaBean is a java class.
This class is developed by using following
standards:
1. Class must be taken as public
2. It is recommended to implement serializable
interface.
3. All member variables are taken as non static
private variable,it is also called as bean
properties.
4. Every variable should have seprate getter and
setter methods.
5. Bean class have zero param constructor directly
or indirectly.
1. Example:
public class StudentBean implement
[Link]
{ //bean properties
private String name;
//Accessor methods
Public void setName(String name)
{
[Link]=name;
}
Public String getName()
{
Return name;
}
Syntax for setter methods:
Compulsory it should be public
The returntype should be void ,because I
am updating the name with this name;
Method name should prefixed with set
Setter methods compulsory should take
some arguments,it should not be no
argument method.
Syntax for getter methods:
Compulsory it should be public
The returntype should not be void
Method name should prefixed with
get,because I am expecting something not
provide anything.
Getter methods should be no argument
method.
THANK YOU……