Java commands

Discussion in 'Java' started by Connie, Jun 3, 2012.

  1. Connie

    Connie New Member

    Joined:
    Jun 3, 2012
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hi there ... my very first forum post :confused:Can some one please explain the difference between Double.parseDouble and Double.toString and when I might use either or both?
     
  2. smohd

    smohd New Member

    Joined:
    Aug 21, 2012
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Student
    Location:
    Zanzibar
    As the functions names explain:
    parseDouble passes a string as parameter and returns a double from it. For example if the string is "123" it returns a double 123. So simply take a numeric string and return it as double.

    But toString returns a string from a double:
    Oracle docs have the info for that: Double Class
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice