CommencerCommencer gratuitement

Assign and print

After declaring variables, you assign values using the = operator. Once assigned, you can print the values using System.out.println().

Give it a go!

Cet exercice fait partie du cours

Introduction to Java

Afficher le cours

Instructions

  • Create a String variable creator and assign "James Gosling" to it.
  • Print the creator variable.

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

class InfoAboutJava {
	public static void main(String[] args) {
    	
        String language = "Java";
        int yearOfOrigin = 1995;
        
        // Create and assign the creator variable
        String ____ ____ ____;
        
        System.out.println(language);
        System.out.println(yearOfOrigin);
        // Print the creator of Java
        System.out.println(____);
    }
}
Modifier et exécuter le code