Compile Error-Double

Write here if you have problems with your Java source code

Moderator: Board moderators

Post Reply
luckyman
New poster
Posts: 3
Joined: Tue Oct 19, 2004 4:11 am

Compile Error-Double

Post by luckyman »

When I submitted 579, I got a Compile Error.
03001178_24.java: In class `Main':
03001178_24.java: In method `start()':
03001178_24.java:42: Can't find method `parseDouble(Ljava/lang/String;)' in class `java.lang.Double'.
h = Double.parseDouble(st.nextToken());
^
03001178_24.java:43: Can't find method `parseDouble(Ljava/lang/String;)' in class `java.lang.Double'.
m = Double.parseDouble(st.nextToken());
^
2 errors
I don't see any reason why i can't use parseDouble
Can someone plz help me
Maniac
Experienced poster
Posts: 105
Joined: Tue Oct 14, 2003 3:24 pm
Location: Utrecht, Holland

Post by Maniac »

The judge uses java 1.1 (it's from the stone age, I know) and it doesn't support the parseDouble method.

Use this
[java]Double.valueOf(s).doubleValue();[/java]
instead of
[java]Double.parseDouble(s);[/java]

If you want, you can download the java 1.1 documentation. Then you can really find out how bad java 1.1 is :-) and what you can expect of course
luckyman
New poster
Posts: 3
Joined: Tue Oct 19, 2004 4:11 am

Post by luckyman »

Thanks for your help
I did not get a Compile Error this time
but i got a WA instead
Post Reply

Return to “Java”