Results 1 to 2 of 2
  1. #1
    romina is offline Member
    Join Date
    Jul 2007
    Posts
    26
    Rep Power
    0

    Default How can I cast Object as an int

    I'm writing a Swing application, and I have a JSpinner object that I modeled on the SpinnerNumberModel.

    There is a getPreviousValue method that returns the value of the previous number in the sequence, only in Object form!

    I need to work with this number as an int.

    How can I cast that Object as an int?
    Thanks

  2. #2
    venkatv is offline Member
    Join Date
    Jul 2007
    Posts
    4
    Rep Power
    0

    Default

    Hi,
    Cast it to Integer object from that you can get the primitive form...

Similar Threads

  1. Replies: 2
    Last Post: 11-26-2010, 02:12 AM
  2. Object
    By sireesha in forum New To Java
    Replies: 1
    Last Post: 01-10-2008, 01:31 AM
  3. How to cast an Object into a specific type (Integer/String) at runtime
    By mailtogagan@gmail.com in forum Advanced Java
    Replies: 2
    Last Post: 12-03-2007, 01:04 PM
  4. Replies: 1
    Last Post: 08-02-2007, 04:07 PM
  5. Creating object of Type Object class
    By venkatv in forum New To Java
    Replies: 3
    Last Post: 07-17-2007, 03:33 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
  •