Version without JavaScript, read-only: workshops, quizzes and running code are not available here. Full version · Catalogue · Sign in

Sequence

Printing an age

Core exercise

Write a static method afficherAge() that declares an integer age = 18 and prints it.

A workshop goes here: you write and run code in it. It requires JavaScript.

Starting code

Exercices.java

public class Exercices {

    public static void main(String[] args) {
        afficherAge();
    }

    public static void afficherAge() {
        // TODO : declarer un int age = 18, puis l'afficher
    }
}

The core exercise is validated in the workshop, which requires JavaScript.

Hint 1

The return type is void: the method prints, it returns nothing.