Hieverbody, Can anyone please tellme how to input floating point variables.I tried using Integer.parseInt for integers and it worked.But Double.parseDouble isnt working.How to deal with this.Thank u all.
HI, Welcome to JavaRanch! parseDouble() is a perfectly good routine -- can you be more specific than "isn't working?" Maybe show the code you tried, tell us what happened, and what you expected to happen instead.
thanks Ernest, i wrote a program that prompts to give cost of a thing in floating point and iused parseDouble method and i use JBuilder to compile and run my programs.While debugging its giving an error message saying method parseDouble[java.lang.String]not found in class java.lang.Double. But it worked fine when i used parseInteger method.Why is this so? Thank u again in advance.
author and iconoclast
A quick check of the Javadocs shows that Double.parseDouble() was introduced in JDK 1.2 -- looks like you're working with a very old version of Java. You could instead use new Double("123.213").doubleValue() ; this ought to work in JDK 1.0 and up. Or you could upgrade to use a more recent Java 2 platform.