|
-
incompatible types ?
I get this error:
incompatible types
found : double
required: java.lang.String
zwembad = Lengte + Breedte + Diepte;
Can anyone tell me what this means?
i have checked my code several times.
This is my code if you are interrested:
// Its a swimming pool that uses length, width and depth.
content is calculated with: length, width and depth
import java.lang.String;
public class Zwembad
{
double Lengte;
double Breedte;
double Diepte;
double Inhoud;
//Methode
public Zwembad(double zbLengte, double zbBreedte, double zbDiepte)
{
Lengte = zbLengte;
Breedte = zbBreedte;
Diepte = zbDiepte;
}
//Methode
public double setLengte ()
{
return Lengte;
}
public double setBreedte ()
{
return Breedte;
}
public double setDiepte ()
{
return Diepte;
}
public double getinhoud ()
{
return (Lengte + Breedte + Diepte);
}
public String toString()
{
String zwembad;
zwembad = Lengte + Breedte + Diepte;
return zwembad;
}
}
this is the main file thats uses "zwembad"
public class Main {
public static void main (String [ ] argv)
{
Zwembad z = new Zwembad (2.0, 5.5, 1.5);
System.out.println (z.getInhoud());
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks