import java.awt.Container;
import java.awt.HeadlessException;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingConstants;
public class Exam01 extends JFrame{
JLabel label;
public Exam01() throws HeadlessException {
label = new JLabel("Hello...Swing", SwingConstants.CENTER);
Container cont = this.getContentPane();
cont.add(label);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String[] args) {
Exam01 ex = new Exam01();
ex.setSize(300, 400);
ex.setVisible(true);
}
}