JAVA: how to convert Object to String to Int in one command line?

Discussion in 'OT Technology' started by sushibug, Dec 15, 2006.

  1. sushibug

    sushibug :happysad:

    Joined:
    May 16, 2002
    Messages:
    3,096
    Likes Received:
    0
    Location:
    San Diego, CA
    String ack = objecthere.toString();
    int huh = Integer.parseInt(ack);



    been using something like that but i'm sure theres a more efficient way to do it.
     
  2. skinjob

    skinjob Active Member

    Joined:
    Jan 6, 2001
    Messages:
    2,337
    Likes Received:
    0
    Location:
    Aztlán
    In one line, it would be:

    int huh = Integer.parseInt(objecthere.toString());
     

Share This Page