Why Java Bean is called "Java Bean" and not Java class or any other? Is there any specific reason to call Java Bean a "Java Bean"?
Not every Java class is a Java Bean. To qualify as a Java Bean, a class must:
1) Be Serializable.
2) Have a no-parameter constructor.
3) Have getters and setters.
As for why the name "Java Bean" and not something a little less silly-sounding, you would have to ask Sun marketing about that :)
Thanks Paul Strack, actually that is the question asked by one of the interviewer, I replied in the way you had given but he asked Why is it called Java Bean, any specific reason? hence I posted that query. Once again I thank for your prompt reply.
It can be pretty difficult sometimes to figure out what an interviewer is looking for from a particular question. Sometimes the interviewer has very particular ideas about "standard" Java concepts, based on the development methodologies of the company you are interviewing with.
That's a silly question for an interviewer to ask, to make it about why it's called what it's called. When I was interviewing for a job once, the interviewer asked me what my favorite Java class was!
Anyway, the best explanation I can muster up is a JavaBean is a sort of component to a larger system, just like a single bean of coffee is a component to a larger bag of coffee grounds.
That's a reach, yeah... but I'm not a coffee drinker. :-) I prefer to get my caffeine from sources like Coke, Jolt, and BAWLZ.
Java is coffee. Coffee comes from coffee beans. Hence the term "Java Bean".
I like coffee. I believe coffee is responsible for a large percentage of the productivity gains over the past decade. The Java language has also made developers more productive. As a matter of fact, I'm drinking coffee today as I write my Java code!