• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Comparable again

 
Andrew Lit
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Comparable c = new Integer(1);
int i = (int)c;// compiler error cannot cast
Is there a way to get that integer i put there?
thank you in advance.
 
Rob Misek
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
int i = (int) c
should be:
int i = c.intValue();
 
Ron Newman
Ranch Hand
Posts: 1056
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you looked at the API documentation for the java.lang.Integer class?
(I could give you the answer, but it's better for you to learn where to find it yourself.)
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Beat me to it again Ron, but it was close that time.
[ October 03, 2002: Message edited by: Barry Gaunt ]
 
Andrew Lit
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your posts. You helped me a lot.
Originally posted by Ron Newman:
Have you looked at the API documentation for the java.lang.Integer class?


Yes i did, but for some reasons i couldn't get what i need. My fault, sorry.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic