Results 1 to 3 of 3
  1. #1
    j2me64's Avatar
    j2me64 is offline Senior Member
    Join Date
    Sep 2009
    Location
    Zurich, Switzerland
    Posts
    962
    Rep Power
    5

    Default state of the art comparing ints in equals()?

    hello everybody,
    I've no problem comparing Strings inside the equals() method but how to compare a field if its type is an int in a good style?

    After opening the thread I found a solution: for primititive types you can use == to compare, ok?
    Last edited by j2me64; 09-19-2011 at 10:24 AM.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,353
    Blog Entries
    7
    Rep Power
    20

    Default Re: state of the art comparing ints in equals()?

    Quote Originally Posted by j2me64 View Post
    hello everybody,
    I've no problem comparing Strings inside the equals() method but how to compare a field if its type is an int in a good style?

    After opening the thread I found a solution: for primititive types you can use == to compare, ok?
    Yep, and also the < relation is defined for ints.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    j2me64's Avatar
    j2me64 is offline Senior Member
    Join Date
    Sep 2009
    Location
    Zurich, Switzerland
    Posts
    962
    Rep Power
    5

Similar Threads

  1. Replies: 2
    Last Post: 02-14-2011, 02:27 PM
  2. Boolean operators on ints
    By rockgardenlove in forum New To Java
    Replies: 3
    Last Post: 02-10-2011, 04:14 AM
  3. Sum of odd ints 0-n
    By falkon114 in forum New To Java
    Replies: 7
    Last Post: 12-06-2010, 08:36 AM
  4. Help with ints
    By Insomniac Riot in forum New To Java
    Replies: 5
    Last Post: 04-02-2010, 03:53 PM
  5. Replies: 0
    Last Post: 01-25-2008, 11:13 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
  •