-1

So I defined an array of the type Character as follows:

Character[] x = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};

When I ran the debugger I noticed that the IDs of all the characters jumped all over the place. For example, the id for 'a' is 31. b's is 32, c:33, d:34, and then e:319, f:320 etc. Until it gets to 'r' where the id is back down to 24.

Whats going on? Are the lower numbers ids for chars while the larger numbers are ids for Characters? Why is it inconsistent within one array? How do I make it so that they're all consistent?

  • 4
    How exactly are you seeing these "IDs"? And why do you care about whether or not they're consistent? What *external effect* are you worried about? I strongly suspect you're worried about a non-issue here. – Jon Skeet Oct 10 '13 at 05:55
  • I'm seeing the IDs in eclipse's debug menu as shown in this image: http://i12.photobucket.com/albums/a244/bengalsrz/debg.png The external effect I'm concerned about is that I believe it is affecting the results of Character's compareTo method that I'm using for a binary search. – Remzi Ibrahim Zayid Oct 10 '13 at 06:03

1 Answers1

0

These are the ID's associated with each object in eclipse, you should be least worried about this.

click here to see discussion

Community
  • 1
  • 1
codingenious
  • 8,385
  • 12
  • 60
  • 90