1.Hello World
public class Hello {
public static void Main (string[] args) {
System.out.println ("Hello, world!");
}
}
This program expresses the meaning of Hello world! Public is open, class is the meaning of classes, in Java is written into a class, hello represents the file name, the first curly brace represents the beginning of the class, and the last curly brace indicates the end of the class,
Static, void, indicates that no feedback is required after the program is finished, main means the eyebrow method, and the curly braces after (string[] args) denote the beginning of the eyebrow method, with curly braces at the end of the eyebrow method.
System.out.println ("Hello, world!") ; out represents the output, print NL it represents the wrapping.
2.import Javax.swing.JOptionPane;
public class Hi
{
public static void Main (string[] args) {
Joptionpane.showmessagedialog (null, "ni");}}
Pop-up Window String dialog box program.
3.import Javax.swing.JOptionPane;
public class Hi {
public static void Main (string[] args) {
String name = Joptionpane.showinputdialog (NULL, "Please enter your name");
Joptionpane.showmessagedialog (NULL, "Are you a monkey-invited tease?") +name);
Joptionpane.showmessagedialog (NULL, "yes");
}}
Pop-up Input dialog box program.
Java the next day