0
public abstract class CircleShape {
	public double radius;
	public CircleShape(){}
	public CircleShape(double radius) {
		this.radius=radius;
	}

	public void setradius(double radius){
		this.radius=radius;
	}


	public String toString()
	{
		return "radius"+ radius;
	}


	abstract String getDisplayText();
}
public class circle extends CircleShape{
private double area;
public double area()
{
	return radius*radius*3.14;
}

public String getDisplayText()
{
	return super.toString() + area;
}


}
public class testcircle{
	public static void main(String[] args){

circle myCircle = new circle();
myCircle.setradius(5.0);
System.out.println(myCircle.getDisplayText());

}

}

I am getting this error while executing:
exception in thread "main" java.lang.NoSuchMethodError

where am i going wrong?

3
Contributors
7
Replies
13
Views
8 Years
Discussion Span
Last Post by BestJewSinceJC
0

Your error message should also indicate which method does not exist. Which one is it complaining about?

0

Exception in thread "main" java.lang.NoSuchMethodError:main

this is the error which I am getting

0

There is your problem. You can't execute all three because testcircle is the only one with a main method. On top of that, I don't think you can execute more than one class at once with the java command. Just change it to java testcircle

0

Yeah, no problem. Ezzaral basically handed me the easy solution though. :p Mark the thread as solved. . ? (I haven't solved one in a good while. . lol)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.