DEV Community

sadiul hakim
sadiul hakim

Posted on

4 4

Hello World in java swing...

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) {

    }
}

Enter fullscreen mode Exit fullscreen mode

Then you need to import JOptionPane from 'javax.swing' package.

import javax.swing.JOptionPane;
Enter fullscreen mode Exit fullscreen mode

Then you need to write this line in your main method.

 JOptionPane.showMessageDialog(null,"Hello World.");
Enter fullscreen mode Exit fullscreen mode

That is it.Easy,Right?

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more