fork download
  1. Canvas canvas;
  2. Cir cir = new Cir();
  3. Rec rec = new Rec();
  4. Tri tri = new Tri();
  5.  
  6.  
  7. canvas.addFigure(cir);
  8.  
  9. abstract class Figure{
  10. abstract boolean overPeriphery();
  11. abstract void clicked();
  12. abstract void display();
  13. }
  14.  
  15. class Canvas{
  16. int x,y;
  17. ArrayList<Figure> fig;
  18. Canvas(int xpos, int ypos){
  19. x = xpos;
  20. y = ypos;
  21. }
  22.  
  23. void addFigure(Figure f){
  24. fig.add(f);
  25. }
  26.  
  27. void display(){
  28. /*
  29.   for(int i = 0; i < fig.size(); i++){
  30.   fig.display();
  31.   }
  32.   */
  33. for(Iterator it = fig.iterator() ; it.hasNext(); ){
  34. it.display();
  35. }
  36. }
  37. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:1: class, interface, or enum expected
Canvas canvas;
^
Main.java:2: class, interface, or enum expected
Cir cir = new Cir();
^
Main.java:3: class, interface, or enum expected
Rec rec = new Rec();
^
Main.java:4: class, interface, or enum expected
Tri tri = new Tri();
^
Main.java:7: class, interface, or enum expected
canvas.addFigure(cir);
^
5 errors
stdout
Standard output is empty