Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

compile error 1

Status
Not open for further replies.

smugindividual

Programmer
Apr 14, 2003
104
US
First time jumping back into java in a long time. Must have really lost the touch. Any help would be appreciated.

compile error:

lab6.java:42: Method parseDouble(java.lang.String) not found in class java.lang.Double.
salary = Double.parseDouble(salaryField.getText());
^
lab6.java:44: Method parseDouble(java.lang.String) not found in class java.lang.Double.
year = Double.parseDouble(yearField.getText());
^
lab6.java:46: Incompatible type for =. Explicit cast needed to convert double to int.
annual = (salary + (year * 200));
^
lab6.java:46: Variable salary may not have been initialized.
annual = (salary + (year * 200));
^
lab6.java:46: Variable year may not have been initialized.
annual = (salary + (year * 200));
^
lab6.java:47: Undefined variable or class name: g
g.drawString ("the total Annual Compensation is $",annual,10,300);
^
6 errors



my imports:

import java.awt.*;
import java.applet.Applet;
import java.awt.event.*;
import java.lang.String.*;
import java.lang.Double.*;
 
I believe your errors are in your imports :

import java.lang.String.*;
import java.lang.Double.*;

First, you don't need to import the java.lang package, as this comes for *free*, as it were. Also, there is no package called "java.lang.Double" - the class Double is within the java.lang package.

There is defintely a static method Double.parseDouble(String) (since SDK 1.2), so if you are using a compiler/SDK below that, then I would get the latest version of Java from
You can tell your java version by doing "java -version" on the command line.
 
curses, 1.1.8-14

I think i may have found a way around it.

var = Double.valueOf(double_var).doubleValue();





thank you for the help though
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top