Forums Register Login

Accessor and Mutator in Java Beans

+Pie Number of slices to send: Send
Can I write Bean without having get or set method ? If no whether it will give me run time error or compile time error ???
Pls help me out !!! Thanks....
+Pie Number of slices to send: Send
Of course you could have a bean without set and get methods. Bean is a Java class and there is no rule about get and set. But if will not have the get and set method than how will you change the bean value? With public fields?
+Pie Number of slices to send: Send
The definition of JavaBean includes getters & setters for variables and a no-parameter constructor. If you leave those things out, it's not a JavaBean. It might still be perfectly useful, but it won't play in frameworks that expect JavaBeans that conform to the definition. Zat help?
I’m tired of walking, and will rest for a minute and grow some wheels. This is the promise of this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1536 times.
Similar Threads
What output do you expect and WHY about the following code?
JSP
JUnit 4 error
Wrapper class doubt
Using hibernate.cfg.xml
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 09:22:59.