aspose file tools*
The moose likes Java in General and the fly likes why bean class called as BEAN Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "why bean class called as BEAN" Watch "why bean class called as BEAN" New topic
Author

why bean class called as BEAN

saikrishna cinux
Ranch Hand

Joined: Apr 16, 2005
Posts: 689
after all bean is also a class file which has got some setters and getters then why must call it as with special name?


why it is called as bean?


A = HARDWORK B = LUCK/FATE If C=(A+B) then C=SUCCESSFUL IN LIFE else C=FAILURE IN LIFE
SCJP 1.4
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Well, for one Beans must follow a specific naming convention for setters and getters. But there is more to it: http://java.sun.com/products/javabeans/faq/faq.general.html#Q2


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41867
    
  63
Darn. Judging by the title of the thread, I was hoping for some explanation of why the word "bean" is used (instead of, say, "ball"). You know, some enlightening coffee analogy. The FAQ talks about reusability, and that's not what I associate with coffee beans


Ping & DNS - my free Android networking tools app
saikrishna cinux
Ranch Hand

Joined: Apr 16, 2005
Posts: 689
yes i need exact answer for this question this was asked in the interview
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

I don't think there is one; I always assumed it was just arbitrary. Your interviewer may as well have asked "why is Java called Java?".

If they had asked "what features could a Bean have?", now that would have been an answerable question.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Originally posted by Paul Sturrock:
"why is Java called Java?".


Because "Oak" was already used, if I remember correctly...
Sujatha Rangarajan
Greenhorn

Joined: Jul 19, 2006
Posts: 23
In 1995, Sun's Oak language was discovered to suffer from trademark problems. A quick hunt for a suitable name followed, and Java was chosen. From this point forward it became obligatory for Java products to have names based on coffee and/or the culture and geography of the Indonesian archipelago. Thus in 1996 when Sun engineers were casting around for a name for Sun's component software architecture, they settled on JavaBeans.

I found the above explanation in sun web site
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14150
    
  18

Originally posted by Sujatha Rangarajan:
... From this point forward it became obligatory for Java products to have names based on coffee and/or the culture and geography of the Indonesian archipelago.

Really? Why did it become obligatory that Java products were named after coffee and/or the culture and geography of the Indonesian archipelago? Is there a law or legal reason that says so? :roll:


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
I assumed it must be a strongly enforced requirement, just by scanning the 3rd party product market.

I really liked "bean". It conjures up thoughts of a glossy hard shell of encapsulation. Then the bean spec completely blows it with accessors, so it's a bean with unsightly holes drilled all around and unclean matter oozing in and out. Yuck.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
saikrishna cinux
Ranch Hand

Joined: Apr 16, 2005
Posts: 689
oh no why java class is called as bean? just by using setters and getters inside a class it got the name called Bean

if i use the same setter and getters in normal classes we wont call it as Bean

why like that?
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14150
    
  18

Saikrishna, your usage of English is a bit confusing... what do you mean by the words "call it as bean"? Please try to phrase your words differently, because it's not clear what exactly you're asking.

Are you asking (1) what a Java Bean is or (2) why it is called a "bean" and not something else?

(1): A Java Bean is a Java class that has a public, no-arguments constructor, that is Serializable and that has getter and setter methods to get and set its properties. That's just how Java Beans are defined. If you write a class that meets these conditions, then your class is a bean, whether you intended it as a bean or not. See the definition on Wikipedia. You can also find lots of information about Java Beans on the JavaBeans homepage.

(2): It's called a "bean" and not something else just because the person that invented Java Beans thought that was a cool name.
[ August 23, 2006: Message edited by: Jesper Young ]
saikrishna cinux
Ranch Hand

Joined: Apr 16, 2005
Posts: 689
Originally posted by Jesper Young:
Saikrishna, your usage of English is a bit confusing... what do you mean by the words "call it as bean"? Please try to phrase your words differently, because it's not clear what exactly you're asking.

Are you asking (1) what a Java Bean is or (2) why it is called a "bean" and not something else?

(1): A Java Bean is a Java class that has a public, no-arguments constructor, that is Serializable and that has getter and setter methods to get and set its properties. That's just how Java Beans are defined. If you write a class that meets these conditions, then your class is a bean, whether you intended it as a bean or not. See the definition on Wikipedia. You can also find lots of information about Java Beans on the JavaBeans homepage.

(2): It's called a "bean" and not something else just because the person that invented Java Beans thought that was a cool name.

[ August 23, 2006: Message edited by: Jesper Young ]


hmmm I got better solution from you thak's boss
so java beans has got no arguments constructor and it must be public class which should also serializable

If a class is not following these principles, will become a normal class
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: why bean class called as BEAN