• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

What is the attribute in this class?

 
Ranch Hand
Posts: 291
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi friends,
Are they attribute in this class?
DBFLD_INITIALS
DBFLD_ID
initials
id
THanks,
Elahe
-------------Code------------
public class User {
public static final String DBFLD_INITIALS= "name";
public static final String DBFLD_ID = "userID";

/** Holds value of property initials. */
private String initials;

/** Holds value of property id. */
private Integer id;

/** Creates new User */
public User() {
}
/** Getter for property initials.
* @return Value of property initials.
*/
public String getInitials() {
return initials;
}
 
Bartender
Posts: 2205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure of the context of your question. DBFLD_INITIALS and DBFLD_ID are compile time constants; they are also class variables, or static variables. initials and id are member variables, sometimes also called fields or attributes, depending on the context. However, if you're talking about the Java Bean spec, then only initials is an attribute, because it's the only member with a public accessor.
So again, the answer to your question depends on the context.
 
Elahe Shafie
Ranch Hand
Posts: 291
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why you don't call DBFLD_INITIALS and DBFLD_ID as a member variable as well? like the same as initials id?
Elahe
 
Rob Ross
Bartender
Posts: 2205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
They are static variables; maybe you can call them "static member variables" but that seems awkward to me. Every User object will have it's own private copy of the variables initials and id, but ALL User objects share ONE copy of the variables DBFLD_INITIALS and DBFLD_ID. Those variables may be members of the User *class*, but they are not members of a User object.
 
Elahe Shafie
Ranch Hand
Posts: 291
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks.
Your signature in cute
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic