When making an application using Swing, I've seen people do one of the two things to create a JFrame. Which is a better approach and why?
I'm a beginner at Java and programming. My only source of learning is books, YouTube and Stack Overflow.
import {imports};
public class GuiApp1 {
    public static void main(String[] args) {
        new GuiApp1();
    }
    public GuiApp1()  {
        JFrame guiFrame = new JFrame();
        guiFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        guiFrame.setTitle("Example GUI");
        guiFrame.setSize(300,250);
        ................
    }
AND
import {imports};
public class GuiApp1 extends JFrame {
    public Execute() {
        getContentPane().setBackground(Color.WHITE);
        getContentPane().setLayout(null);
        setSize(800, 600);
        .............
    }
    public static void main(String[] args) {
        Execute frame1 = new Execute();
        frame1.setVisible(true);
    }
}