I am trying to compile this code on CMD.
public class Main {
public static void main(String[] args){
new HelloWorld("Main Window");
}
}
this is the HelloWorld class
import javax.swing.JFrame;
public class HelloWorld extends JFrame{
public HelloWorld(String title){
super(title);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
}
}
but it is giving me an error like CMD snap shot
but when I instantiate HelloWorld in the same class with the main method, it runs fine.