Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Object to Integer

Reply
Thread Tools

Object to Integer

 
 
Dino Buljubasic
Guest
Posts: n/a
 
      02-04-2005
Hi

I am new to java, have a simple problem.

I pass to a procedure anObject as :

firePropertyChange(propertyName, new Integer( oldInt), new
Integer(newInt)) {}

firePropertyChange parameters must be of an Object value, if they are
primitives as in this example, I must wrap them up

how do I get the integer values inside that procedure ?
thanks
 
Reply With Quote
 
 
 
 
Eric Sosman
Guest
Posts: n/a
 
      02-04-2005


Dino Buljubasic wrote:
> Hi
>
> I am new to java, have a simple problem.
>
> I pass to a procedure anObject as :
>
> firePropertyChange(propertyName, new Integer( oldInt), new
> Integer(newInt)) {}
>
> firePropertyChange parameters must be of an Object value, if they are
> primitives as in this example, I must wrap them up
>
> how do I get the integer values inside that procedure ?


Object obj = new Integer(42);
int answer = ((Integer)obj).intValue();

--


 
Reply With Quote
 
 
 
 
Tim Slattery
Guest
Posts: n/a
 
      02-04-2005
Dino Buljubasic <> wrote:


>firePropertyChange(propertyName, new Integer( oldInt), new
>Integer(newInt)) {}


>how do I get the integer values inside that procedure ?
>thanks


Use the intValue method of the Integer object

--
Tim Slattery

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I add an Integer to another Integer? Sebastian Stelzer Java 6 04-07-2010 07:03 PM
CType(x,Integer) vs. Integer.Parse(x) =?Utf-8?B?Sm9l?= ASP .Net 7 02-07-2006 02:30 AM
Object creation - Do we really need to create a parent for a derieved object - can't the base object just point to an already created base object jon wayne C++ 9 09-22-2005 02:06 AM
How do I add an Integer to another Integer? Sebastian Stelzer Java 2 10-15-2004 01:17 PM
No Math.min(Integer, Integer)? =?ISO-8859-1?Q?Thomas_Gagn=E9?= Java 0 07-29-2003 07:46 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57