Get startedGet started for free

Assign and print

Once you've created variables, you can assign values to them and display those values. This is a fundamental pattern you'll use throughout your programming journey. In this exercise, two variables have already been created for you: language and yearOfOrigin.

This exercise is part of the course

Introduction to Java

View Course

Exercise instructions

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

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

class InfoAboutJava {
	public static void main(String[] args) {
    	
        String language = "Java";
        int yearOfOrigin = 1995;
        
        // Create and assign the text variable creator
        String ____ ____ ____;
        
        System.out.println(language);
        System.out.println(yearOfOrigin);
        // Print the creator of Java
        System.out.println(____);
    }
}
Edit and Run Code