Object to Integer

  • Thread starter Dino Buljubasic
  • Start date
D

Dino Buljubasic

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
 
E

Eric Sosman

Dino said:
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();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,151
Latest member
JaclynMarl
Top