Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Java UML diagram question

  1. #1
    Member
    Join Date
    Feb 2011
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Java UML diagram question

    I have a java program to write and the professor gave us a UML diagram to follow. It all makes sense except for the part where there are dollar signs. What do these dollar signs mean? Here's what it looks like:

    Wrestler
    - firstName : String The wrestler’s first name.
    - lastName : String The wrestler’s last name.
    - weight : double The wrestler’s weight.
    - grade : int The wrestler’s grade expressed as a number.
    $sortKey int A class-level variable used to specify how all Wrestler objects should be sorted.
    $COMPARE_BY_NAME : int = 1 A class-level constant used to specify that Wrestlers should be sorted by last name.

    Do these dollar signs indicate constants? If so, then why does this method have a dollar sign in front of it too?
    $setKey(int):void A class-level method used to set the sort key for all Wrestler objects.


  2. #2
    Member snowguy13's Avatar
    Join Date
    Nov 2011
    Location
    In Hyrule enjoying a chat with Demise and Ganondorf
    Posts
    339
    My Mood
    Happy
    Thanks
    31
    Thanked 48 Times in 42 Posts

    Default Re: Java UML diagram question

    The dollar sign ($) is an old way of indicating static methods or variables. So, while you will create instances of the wrestler object, the variable sortKey and the named constant COMPARE_BY_NAME will not be created for every instance. Instead, this variable and constant will only exist once for the entire class (these are called static variables).

    Hopefully I explained that well...

    By the way, after researching I found out that the new convention for showing static variables or methods in a UML is to underline them. Putting a $ in front of them is now outdated. ;D
    Use highlight tags to help others help you!

    [highlight=Java]Your prettily formatted code goes here[/highlight]

    Using these tags makes your code formatted, and helps everyone answer your questions more easily!




    Wanna hear something funny?

    Me too.

Similar Threads

  1. Banking System UML Class Diagram in to code.
    By djl1990 in forum Java Theory & Questions
    Replies: 2
    Last Post: October 13th, 2011, 11:55 AM
  2. UML Class Diagram
    By LDM91 in forum Java Theory & Questions
    Replies: 4
    Last Post: December 27th, 2010, 12:04 PM
  3. Replies: 2
    Last Post: April 21st, 2010, 10:25 AM
  4. need API for Connection Routing in Interactive Diagram Editor
    By pavan arepu in forum AWT / Java Swing
    Replies: 2
    Last Post: April 21st, 2010, 10:19 AM
  5. UML Diagram Help
    By chizzle in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 15th, 2010, 04:12 AM