Computer Science Canada how do i parse in a double? |
Author: | Homer_simpson [ Fri Feb 13, 2004 1:52 pm ] |
Post subject: | how do i parse in a double? |
how do i parse in a double? |
Author: | wtd [ Fri Feb 13, 2004 5:36 pm ] |
Post subject: | |
See my post in this thread. http://www.compsci.ca/v2/viewtopic.php?t=3632 |
Author: | Homer_simpson [ Fri Feb 13, 2004 8:16 pm ] |
Post subject: | |
well if u'd looked at that post closely u'd see that i've got 2 posts in there... and it doesn't work... but thx for response... but anyway i figured how to do it... u can just use Double.valueOf to parse it in... |
Author: | Dan [ Fri Feb 13, 2004 10:28 pm ] |
Post subject: | |
thats odd, Double.parseDouble(String) works for me, same with it's int equivlent. are u using an unstandered java lib or somting? |
Author: | Homer_simpson [ Fri Feb 13, 2004 11:28 pm ] |
Post subject: | |
yes but there's a difference between Double and double... |
Author: | Paul [ Fri Feb 13, 2004 11:32 pm ] |
Post subject: | |
Hacker Dan wrote: thats odd,
Double.parseDouble(String) works for me, same with it's int equivlent. are u using an unstandered java lib or somting? Thats always what I used too, I just didn't wanna post, cause i wasn't sure, since Homer already posted this on the other help thread, so I thought if he knew about it... Oh and I thought double was just a kind of a variable that can have decimals, you know... when you declare it its double, but when you use it in that line its Double, just like parsInt. Im not sure though. |
Author: | wtd [ Fri Feb 13, 2004 11:59 pm ] | ||
Post subject: | |||
In Java not everything is an object. Most things are, but there are also some basic types:
These are passed by value, rather than by reference, a behavior that's quite often expected to be correct. The problem is that there are lots of places in Java that only objects can go, so most of those types, including double, are also classes, though in Java-style, the class name begins with a capital letter. Since Java doesn't support operator overloading (except in the String class, and you'll have to talk to Sun about that one), you can't have code like:
Though I don't know how this holds up now that Java 1.5 features auto-boxing. I hope that helped you understand the difference between "Double" and "double". |
Author: | Homer_simpson [ Sat Feb 14, 2004 2:30 am ] |
Post subject: | |
yes and Double isn't just a variable type... it's a full class with a lotta constructors... veryuseful... |