J
Julied
Gast
Code:
package rectangle;
public class Rectangle {
private int height = 1;
private int width = 1;
public Rectangle() {}
public Rectangle (int height, int width) {
this.height = height;
this.width = width;
}
public int getHeight() {
return height;
}
public int getWidth() {
return width;
}
public int getArea() {
return height * width;
}
public void setHeight(int height) {
this.height = height;
}
public void setWidth(int width) {
this.height = width;
}
public void setDimension(int height, int width) {
this.height = height;
this.width = width;
}
}
//Test-Klasse
package rectangle;
import rectangle.*;
public class TestApp {
public static void main(String[] args) {
Rectangle rect = new Rectangle(1,3);
System.out.println("Fläche = " + rect.getArea() + " m³");
}
}
Nun diese beiden Dateien habe ich nun geschrieben. nun habe ich die erste compiliert und es klappte. bei der 2. meldet er in Zeile 5 2 Fehler, "Cannot find Symbol" bei Rectangle rect und bei Rectangle(1,3);
Was mach ich hier falsch? mein Pfad ist
D:/java/projekte/new/rectangle/
Hat da jemand ne idee?
sorry bin halt noch Anfänger.....
L-ectron-X hat den Titel angepasst.