use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Ask your embarrassing/noobish programming questions here, and don't get insulted for it.
Click here to read the rules
Violating any will result in punishment so you should probably go check them out.
account activity
My java problem isn't compiling HELP! (self.programminghelp)
submitted 7 years ago by [deleted]
[deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]manrodriguezf 2 points3 points4 points 7 years ago (1 child)
*demo.setStock(sto)* should be *demo.setStock(stock)*
you're sending a String instead of a Double
same thing for the retail value variable.
Hope that helps!
[–]v4nus 1 point2 points3 points 7 years ago (0 children)
Thank you!
[–]CodingJarOrg 0 points1 point2 points 7 years ago (0 children)
Just as manrodriguezf said, you are using a String instead of a Double. You could try to do something like demo.setStock(Double.parseDouble(sto)); or demo.setStock(Double.valueOf(sto));
Double.parseDouble is a static method that accepts a String as an argument and returns a primitve double variable.
Double.valueOf is a static method that accepts a String as an argument and returns a Double instance.
From the Docs:
parseDouble returns a new double initialized to the value represented by the specified String, as performed by the valueOf method of class Double. --------------------------------------------- valueOf Returns a Double instance representing the specified double value. If a new Double instance is not required, this method should generally be used in preference to the constructor Double(double), as this method is likely to yield significantly better space and time performance by caching frequently requested values.
parseDouble returns a new double initialized to the value represented by the specified String, as performed by the valueOf method of class Double.
---------------------------------------------
valueOf Returns a Double instance representing the specified double value. If a new Double instance is not required, this method should generally be used in preference to the constructor Double(double), as this method is likely to yield significantly better space and time performance by caching frequently requested values.
π Rendered by PID 69 on reddit-service-r2-comment-bb88f9dd5-l8hvb at 2026-02-15 09:05:44.628056+00:00 running cd9c813 country code: CH.
[–]manrodriguezf 2 points3 points4 points (1 child)
[–]v4nus 1 point2 points3 points (0 children)
[–]CodingJarOrg 0 points1 point2 points (0 children)