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: Boolean method issue

  1. #1
    Junior Member
    Join Date
    Oct 2011
    Posts
    8
    My Mood
    Confused
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Boolean method issue

    I'm trying to program a boolean method that compares two doubles of an Object and if they are within 0.00001 of each other they are equal
       public boolean equals ( 2D that )
       {
          if ( ((Math.abs(x-that.x) >= 0.00001) ||
                (Math.abs(x-that.x) <= 0.00001))
                && ((Math.abs(y-that.y) >= 0.00001) ||
                (Math.abs(y-that.y) <= 0.00001)))         return true;
          else                                           return false;
     
       }


  2. #2
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: Boolean method issue

    and your problem is?
    Improving the world one idiot at a time!

Similar Threads

  1. passing boolean value issue
    By tr_tech in forum Member Introductions
    Replies: 1
    Last Post: June 17th, 2011, 09:13 AM
  2. Need help with boolean method! =(
    By leao in forum What's Wrong With My Code?
    Replies: 4
    Last Post: December 14th, 2010, 10:18 AM
  3. Boolean method returning a boolean value
    By Deprogrammer in forum What's Wrong With My Code?
    Replies: 1
    Last Post: November 21st, 2010, 10:56 AM
  4. Method returning boolean
    By Plural in forum What's Wrong With My Code?
    Replies: 3
    Last Post: November 13th, 2010, 06:45 PM
  5. ArrayList Boolean Issue
    By kite98765 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 8th, 2010, 08:15 AM