Surely we can have data member with default access / public access in the Java Bean. But it's good practice to have data member as Private and get them access by getter and setter methods.
also you need not to make getter and setter method for each of the data member. But if you dont have a getter /setter method for a private data member you won't be able to access that data member.
Do not wait to strike till the iron is hot; but make it hot by striking....
Joined: Oct 13, 2005
The idea of a bean is that it has a no-arguments public constructor and public get and set methods for every field. That way it is possible to write the state of the class into an XML file and reconstruct it later.