Hello World Pt2
| Posted in Hello World , Java , JOptionPane , System.out.println() | Posted on 7:28 PM
After one or two compilation errors I eventually got a clean build. I love the way /* comments look as opposed to //. It's an aesthetic, but you have to enjoy the simple things.
/*
* This is a simple demo displaying "Hello World".
*/
package helloworld;
/**
* @author Neil
*/
public class Main {
public static void main(String[] args) {
System.out.println("Hello World");
}
}
The author suggested pulling in an additional class that enables dialog boxes. This was done by "importing" it. I don't know how people remember these long class names. Maybe it comes with time. Sometimes the IDE will pop up suggestions. It suggested System.out.println but didn't do anything with JOptionPane.showMessageDialog.
/*
* This is a simple demo displaying "Hello World".
*/
package helloworld;
/*Pull in a class that enables a pop up msg box.*/
import javax.swing.JOptionPane;
/**
* @author Neil
*/
public class Main {
public static void main(String[] args) {
/*Output window.*/
JOptionPane.showMessageDialog(null, "Hello World!");
}
}
Yep. The dialog box popped up just like it should have. Huzzah!
Comments Posted (0)
Post a Comment