1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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