Hello guys today i am going to show you how you can print "Hello World" in java swing.
Now, what is java swing?
ANS : Swing is a GUI widget toolkit for Java. It is part of Oracle's Java Foundation Classes (JFC) – an API for providing a graphical user interface (GUI) for Java programs. Swing was developed to provide a more sophisticated set of GUI components than the earlier Abstract Window Toolkit (AWT)
Let's get started...
First of all you need to create a general class inside you package.
package com.hakim;
public class HelloWorld {
public static void main(String[] args) {
}
}
Then you need to import JOptionPane
from 'javax.swing' package.
import javax.swing.JOptionPane;
Then you need to write this line in your main method.
JOptionPane.showMessageDialog(null,"Hello World.");
That is it.Easy,Right?
Top comments (0)