JAVA · ОСНОВЫ · LESSON 01

First greeting.

Class, main and output · about 12 minutes

Learning with progressRead the summary for free. To save the work, log in to the account.
STEP 1

The program begins at the door.

In Java, the code is placed in the classroom. For our first programs, the class is called Main. Inside it, the main method is the door from which the Java starts working.

public class Main {
    public static void main(String[] args) {
    }
}
The path of the programme
MainplayhousemaindoorwayCodeaction

✦ The brackets show where the program begins and ends.

STEP 2

Show me the text.

System.out.println shows the words on the screen. The text is double quote marks. Put a semicolon at the end of the command.

public class Main {
    public static void main(String[] args) {
        System.out.println("Привет!");
    }
}

✦ There's going to be Hello on the screen!

IN-CLASS PRACTICE

Type the code yourself

Reprint the example with your own hands. Watch for brackets, quotation marks and a semicolon.

public class Main {
    public static void main(String[] args) {
        System.out.println("Доброе утро!");
    }
}
Open the editor for class work
HOMEWORK

Solve it yourself

In the Main class, learn the phrase «Привет, Java!». Use main and System.out.println.

The answer is hidden. Use similar examples from the lesson notes.

Opening up your homework