[sourcecode=’java’]
//import directives
import javax.swing.*;
public class HelloJava {
//main method
public static void main( String[] args ) {
JFrame frame = new JFrame( “Hello Java !!” ); //Labeling Frame Title
JLabel label = new JLabel(“Hello Java !!”, JLabel.CENTER );
frame.getContentPane( ).add( label );
frame.setSize( 400, 300 ); //width and height
frame.setVisible( true );
}
}
[/sourcecode]
Output: