public static void main(String agrs)
JFrame window = new JFrame("Jason's Canvas"); //title name
window.setSize(800, 600);//set the sixe of the window
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//the methood window.setDefaultCloseOperation is specifcally for the constant Jframe.EXIT_ON_CLOSE to close the application
window.setVisible(true);//Function window.setVisible. A function available to window-based terminal objects created via the window API, which toggles the visibility flag
Graphics2D g2d = (Graphics2D) g;
g2d.drawRect(30, 50, 420, 120);
As my working version is almost entirely different from the original repl.