Results 1 to 4 of 4

Thread: how to use valueof

  1. #1
    Junior Member
    Join Date
    Feb 2008
    Answers
    3

    Question how to use valueof

    hi All,

    How to convert String to number with sample example.

    have a nice day.


  2. #2
    Contributing Member
    Join Date
    Sep 2006
    Answers
    42

    Re: how to use valueof

    Use
    Integer.parseInt("3");
    It throws an exception if the string contains an invalid number.

    Regards,
    Sahil.


  3. #3
    Junior Member
    Join Date
    Feb 2008
    Answers
    3

    Re: how to use valueof

    Quote Originally Posted by SahilKabra View Post
    Use
    Integer.parseInt("3");
    It throws an exception if the string contains an invalid number.

    Regards,
    Sahil.
    Thanx for ur reply,plz explain me with example how to convert string to integer.


  4. #4
    Contributing Member
    Join Date
    Sep 2006
    Answers
    42

    Re: how to use valueof

    public static void main (String [] args) throws Exception {
    String number = "30";
    System.out.println(Integer.parseInt(number));
    }

    Please paste this in a java class file.

    Regards,
    Sahil.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact