File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes error message Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "error message" Watch "error message" New topic
Author

error message

ricky barnes
Greenhorn

Joined: Jul 16, 2002
Posts: 2
get complie error "missing method body or declare abstract" when extending abstact class.
Max Habibi
town drunk
( and author)
Sheriff

Joined: Jun 27, 2002
Posts: 4118
Hi Ricky,
This means that your abstract class has declared a method that your Imp class has not implemented.
HTH,
M


Java Regular Expressions
ricky barnes
Greenhorn

Joined: Jul 16, 2002
Posts: 2
Max,
First thank you for your help but we are still get the same error message. I thought that encluding the code and the error message may help you help us.
Ricky
// July 17, 2002
// Project 7
// This project consists of an abstract class and three concrete
// classes (this is one). There is also a test program
// which will prove the exercise.
// Java packages
import java.awt.*;
import java.text.*;
import java.awt.event.*;
import javax.swing.*;
public class MyRectangle extends TwoDShape
{
protected float length;
protected float width;

public MyRectangle()
{
setLength (1);
setWidth (1);
}

public MyRectangle (float rectLength, float rectWidth)
{
setLength(rectLength);
setWidth(rectWidth);
} // end constructor

public void setLength(float rectLength);
{
length = (rectLength >= 1 ? rectLength : 1);
}
public void setWidth(float rectWidth);
{
width = (rectWidth >= 1 ? rectWidth : 1);
}
public float getArea()
{
return length;
}// end getLength
public float getPerimeter()
{
return width;
}// end getWidth

public float calcArea()
{
return area = width * length;
}// end calcArea

public float calcPerimeter()
{
return perimeter = (length + width) * 2;
}// end calcPerimeter

public String toString()
{
return "Length = " + length +
"\nWidth = " + width;
} // end toString
public String getName()
{
return "Rectangle: ";
} // end getName

} // end MyRectangle
--------------------Configuration: JDK version 1.3 <Default>--------------------
D:\Project7\MyRectangle.java:30: missing method body, or declare abstract
public void setLength(float rectLength);
^
D:\Project7\MyRectangle.java:32: cannot resolve symbol
symbol : variable rectLength
location: class MyRectangle
length = (rectLength >= 1 ? rectLength : 1);
^
D:\Project7\MyRectangle.java:32: cannot resolve symbol
symbol : variable rectLength
location: class MyRectangle
length = (rectLength >= 1 ? rectLength : 1);
^
D:\Project7\MyRectangle.java:35: missing method body, or declare abstract
public void setWidth(float rectWidth);
^
D:\Project7\MyRectangle.java:37: cannot resolve symbol
symbol : variable rectWidth
location: class MyRectangle
width = (rectWidth >= 1 ? rectWidth : 1);
^
D:\Project7\MyRectangle.java:37: cannot resolve symbol
symbol : variable rectWidth
location: class MyRectangle
width = (rectWidth >= 1 ? rectWidth : 1);
^
6 errors
Process completed.
Max Habibi
town drunk
( and author)
Sheriff

Joined: Jun 27, 2002
Posts: 4118
Ricky,
You need to remove the ';' after the declaration

HTH,
M
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

and 'public void setWidth(float rectWidth);' as well
/Rene


Regards, Rene Larsen
Dropbox Invite
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: error message
 
Similar Threads
problem in retreiving value
Getting error in setupConnection()
Regarding tomcat
print statement in the declaration ...
WA #1.....word association