Switch to full style
Java2 codes,problems ,discussions and solutions are here
Post a reply

What is javaBeans

Sat Jan 31, 2009 1:35 am

What is javaBeans?
Javabean class is a type of java classes that is follow some rules for methods and naming.

The Rules of JavaBean class:
1. The properties variables are private and accessed due the set and get methods.
2. First letter in property name must be lowercase and any start world latter must be uppercase. (ex : myName)
3. The name of setter function is set followed by the property name but every first letter is upper case. (ex: setmyName(String MyName) ) .
4. Setters and getters are public.
5. Getters have no parameter.
6. Setters have void return type.
Code:
public class FilmBean {
private String filmName;
// getter method for property filmName
public String getFilmName() {
return filmName;
}
// setter method to set the value of the property filmName
public void setFilmName(String newFilm) {
filmName = newFilm;
}


JavaBean classes (with it standards and rules ) allow the reusability of the components , and avoid creating the system from scratch ,naming conventions standards help tools to use JavaBeans componets.



Post a reply
  Related Posts  to : What is javaBeans
 What is JAVABEANS? !!!     -  
 What is Enterprise JAVABEANS? !!     -  

Topic Tags

Servlets/JSP