fork download
  1. Canvas canvas;
  2. Cir cir = new Cir();
  3. Rec rec = new Rec();
  4. Tri tri = new Tri();
  5.  
  6. void setup(){
  7. canvas.addFigure(cir);
  8. }
  9.  
  10. void draw(){
  11. }
  12.  
  13. class Canvas{
  14. int x,y;
  15. ArrayList<Figure> fig;
  16. Canvas(int xpos, int ypos){
  17. x = xpos;
  18. y = ypos;
  19. }
  20.  
  21. void addFigure(Figure f){
  22. fig.add(f);
  23. }
  24.  
  25. void display(){
  26. for(Figure f:fig){
  27. f.display();
  28. }
  29. }
  30. }
  31.  
  32. class Cir extends Figure{
  33. Cir(){
  34. }
  35. boolean overPeriphery(){
  36. return true;
  37. }
  38. void clicked(){
  39. }
  40. void display(){
  41. }
  42. }
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:6: class, interface, or enum expected
void setup(){
^
Main.java:8: class, interface, or enum expected
}
^
6 errors
stdout
Standard output is empty