Whenever I run this I get an error:
"Exception in thread "main" java.lang.NullPointerException at anime.re.drawShape(re.java:17) at anime.re.main(re.java:12)"
I am not passing a null reference, what is the problem?
import javax.swing.JFrame;
import java.awt.Graphics;
public class re {
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.setSize(400, 400);
Graphics g = frame.getGraphics();
drawShape(g);
frame.setVisible(true);
}
public static void drawShape(Graphics g) {
g.drawOval(0, 0, 100, 100);
}
}