Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2011
    Rep Power

    Default Using Booleans for equality?

    Working on a school project and our professor has supplied us with three classes. we are to implement a fourth class called "Sprite" using a specified UML.

    The UML part that I'm having trouble with looks like this:

    +equals(other : Sprite) : boolean

    how do i write this code? I know it needs to return a boolean, and I'm supposed to check if the sprite i have in my class equals the other sprite. I'm lost.

  2. #2
    Jodokus's Avatar
    Jodokus is offline Senior Member
    Join Date
    Jan 2011
    Amsterdam, the Netherlands
    Rep Power


    My question to you would be:
    Which part do you understand, which part not?
    But you give a rather complete description of the specs in the last line so what's the problem except being lost?

    - Do you understand the UML, what does it mean exactly?
    - Do you have an idea of what a sprite looks like, and what makes one sprite equal to an other?
    - Is the Java itself giving you trouble?
    - What code did you allready come up with?

    (In your next post try to answer all these questions first.)

Similar Threads

  1. arrays with booleans
    By hoosierfan24 in forum New To Java
    Replies: 24
    Last Post: 10-04-2010, 01:07 AM
  2. compare the remaining of Strings for equality
    By Cylab in forum New To Java
    Replies: 5
    Last Post: 08-19-2010, 02:42 PM
  3. compare the remaining of Strings for equality
    By Cylab in forum Advanced Java
    Replies: 6
    Last Post: 08-19-2010, 02:40 PM
  4. String Object equality with == operator
    By kumar080780 in forum New To Java
    Replies: 4
    Last Post: 10-29-2008, 07:57 AM
  5. JSTL -- Comparing two strings for equality
    By trinkets in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 02-12-2008, 05:39 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts