fork download
  1. public class Test extends JFrame {
  2.  
  3. public Test() {
  4. this.setPreferredSize(new Dimension(400, 400));
  5. this.pack();
  6. this.setVisible(true);
  7. this.setDefaultCloseOperation(EXIT_ON_CLOSE);
  8. }
  9.  
  10. @Override
  11. public void paint(Graphics g) {
  12. super.paint(g);
  13.  
  14. // define the position
  15. int locX = 200;
  16. int locY = 200;
  17.  
  18. // draw a line (there is no drawPoint..)
  19. g.drawLine(locX, locY, locX, locY);
  20. }
  21.  
  22. public static void main(String[] args) {
  23. Test test = new Test();
  24. }
  25. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:1: error: class Test is public, should be declared in a file named Test.java
public class Test extends JFrame {
       ^
Main.java:1: error: cannot find symbol
public class Test extends JFrame {
                          ^
  symbol: class JFrame
Main.java:11: error: cannot find symbol
    public void paint(Graphics g) {
                      ^
  symbol:   class Graphics
  location: class Test
Main.java:4: error: cannot find symbol
        this.setPreferredSize(new Dimension(400, 400));
                                  ^
  symbol:   class Dimension
  location: class Test
Main.java:5: error: cannot find symbol
        this.pack();
            ^
  symbol: method pack()
Main.java:6: error: cannot find symbol
        this.setVisible(true);
            ^
  symbol: method setVisible(boolean)
Main.java:7: error: cannot find symbol
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
                                      ^
  symbol:   variable EXIT_ON_CLOSE
  location: class Test
Main.java:10: error: method does not override or implement a method from a supertype
    @Override
    ^
Main.java:12: error: cannot find symbol
        super.paint(g);
        ^
  symbol:   variable super
  location: class Test
9 errors
stdout
Standard output is empty