Copilo a classe Main aonde esta o metodo main e diz : java.lang.NoSuchMethodError: main, Exception in thread "main"
Seguem as classes:
public class Main {
public static void main(String[] args) {
Ponto p = new Ponto(1,1), q = new Ponto(3,4),
d = new Ponto(2);
Retangulo r1 = new Retangulo(p,q),
r2 = new Retangulo(new Ponto(2), new Ponto(5));
Display display = new Display();
display.addRet(r1);
display.addRet(r2);
display.show(System.out);
r1.deslocarX(-2);
display.show(System.out);
}
}
class Display {
Retangulo[] ret = new Retangulo[5];
int next = 0;
void addRet(Retangulo r) {
ret[next++] = r;
next = next%(ret.length);
}
void show(java.io.PrintStream s) {
for(int i = 0; i < next; i++) {
s.println(ret[i]);
}
}
}
class Retangulo {
Ponto a,b;
Retangulo() {}
Retangulo(Ponto p1, Ponto p2) {
a = p1;
b = p2;
}
void deslocarX(int val) {
a.deslocarX(val);
b.deslocarX(val);
}
void deslocarY(int val) {
a.deslocarY(val);
b.deslocarY(val);
}
int largura() {
return Math.abs(a.x - b.x);
}
int altura() {
return Math.abs(a.y - b.y);
}
Ponto origem() {//pto sup esq
int x0 = a.x, y0 = a.y;
if (a.x>b.x) x0 = b.x;
if (a.y<b.y) y0 = b.y;
return new Ponto(x0,y0);
}
public String toString() {
return "Retangulo(" + this.origem()
+ ", " + this.largura()
+ ", " + this.altura()
+ ")";
}
}//
ALGUEM SABE COMO EU RESOLVO ISSO!! TO COPILANDO A CLASSE MAIN E TO USANDO O JCREATOR
VLWWW