fateme_s
شنبه 11 آبان 1387, 16:34 عصر
سلام
من برنامه ام رو تو notepad نوشتم و حالا اونو تو dos با موفقیت کامپایل کردم ولی الان می زنم با java Shapes2 اجرا بشه نمیشه و خطای زیر رو می ده این خطا برای چیه ممنون میشم جوابم رو بدید.
Exception in thread "main" java.lang.NoClassDefFoundError: Shapes2
پیشاپیش تشکر می کنم.
اینم سورس برنامه من:
class TwoDShape {
private double width;
private double height;
// Accessor methods for width and height.
s
double getWidth() { return width; }
double getHeight() { return height; }
void setWidth(double w) { width = w; }
void setHeight(double h) { height = h; }
void showDim () {
System.out.println("Width and height are " + width + " and " + height);
}
}
class Triangle extends TwoDShape {
String style;
double area () {
return getWidth() * getHeight () / 2;
}
void showStyle() {
System.out.println("Triangle is " + style);
}
}
class Shapes2 {
public static void main(String args[]) {
Triangle t1 = new Triangle();
Triangle t2 = new Triangle();
t1.setWidth(4.0);
t1.setHeight(4.0);
t1.style = "isosceles";
t2.setWidth(8.0);
t2.setHeight(12.0);
t2.style = "right";
System.out.println("Info for t1: ");
t1.showStyle();
t1.showDim();
System.out.println("Area is " + t1.area());
System.out.println();
System.out.println("Info for t2: ");
t2.showStyle();
t2.showDim();
System.out.println("Area is " + t2.area());
}
}
من برنامه ام رو تو notepad نوشتم و حالا اونو تو dos با موفقیت کامپایل کردم ولی الان می زنم با java Shapes2 اجرا بشه نمیشه و خطای زیر رو می ده این خطا برای چیه ممنون میشم جوابم رو بدید.
Exception in thread "main" java.lang.NoClassDefFoundError: Shapes2
پیشاپیش تشکر می کنم.
اینم سورس برنامه من:
class TwoDShape {
private double width;
private double height;
// Accessor methods for width and height.
s
double getWidth() { return width; }
double getHeight() { return height; }
void setWidth(double w) { width = w; }
void setHeight(double h) { height = h; }
void showDim () {
System.out.println("Width and height are " + width + " and " + height);
}
}
class Triangle extends TwoDShape {
String style;
double area () {
return getWidth() * getHeight () / 2;
}
void showStyle() {
System.out.println("Triangle is " + style);
}
}
class Shapes2 {
public static void main(String args[]) {
Triangle t1 = new Triangle();
Triangle t2 = new Triangle();
t1.setWidth(4.0);
t1.setHeight(4.0);
t1.style = "isosceles";
t2.setWidth(8.0);
t2.setHeight(12.0);
t2.style = "right";
System.out.println("Info for t1: ");
t1.showStyle();
t1.showDim();
System.out.println("Area is " + t1.area());
System.out.println();
System.out.println("Info for t2: ");
t2.showStyle();
t2.showDim();
System.out.println("Area is " + t2.area());
}
}