JDK installation and configuration, basic source code structure

JDK installation and configuration (using Win10)

    1. DL the JDK http://www.oracle.com/technetwork/jp/java/javase/downloads/index.html http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
  1. Pass through Edit System-> Advanced-> Advanced tab-> Environment Variables-> System Variable Path

Copy the variable value to a memo once. (Be careful because if you make a mistake in even one character of the variable value, it will not work.)

Copy the path to the folder where the JDK is located and paste it at the beginning of the variable value you copied earlier. C:\Program Files\Java\jdk1.8.0_111\bin

Basic structure of the program

java.filename.rb


class Abc {                               //Class declaration
    public static void main(String[] args) {    //Main method
        System.out.print("ABC");                //Sentence
        System.out.println("DEF");
    }
}

There is a class declaration, in which the main method is. The statements described in the main method are executed in order from the top.

"System.out" is a standard output stream associated with the console screen. “Print” means to display, and “ln” means to start a new line. Therefore, "System.out.println" will be displayed on the console screen with line breaks.

The ";" at the end of the sentence is the same as the Japanese punctuation mark, and ends with ";" in the source code.

The result of this execution is displayed as "ABCDEF" on the console screen.

Recommended Posts

JDK installation and configuration, basic source code structure
Basic structure of Java source code
Basic usage of enums and code examples