Skip to content

Instantly share code, notes, and snippets.

@musoftware
Created June 10, 2017 21:45
Show Gist options
  • Save musoftware/eb0a0e1588bbe7fa72aadbd856cfe169 to your computer and use it in GitHub Desktop.
Save musoftware/eb0a0e1588bbe7fa72aadbd856cfe169 to your computer and use it in GitHub Desktop.
The first Java program
import java.lang.*;
public class First {
public static void main(String[] args) {
System.out.println("This is my first Java program.");
}
}
/*
The statements have the following meaning:
import java.lang.*; request to use libraries of predefined classes/programs (in fact, the java.lang library is imported automatically, hence this statement can be omitted)
public class First {...} definition of a class/program called First
public static void main(String[] args) {...} definition of the main method (a method is the realization of an operation in Java)
System.out.println("This is my first Java program."); statement to print a message on the video
System.out predefined object/instance of the predefined class PrintStream
println method of the class PrintStream applied to the object System.out
"This is my first Java program." object of the class String representing the sentence to display
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment