LoslegenKostenlos loslegen

Creating a variable

Before using a variable, you need to declare it by specifying its type and name. Java requires every variable to have a type that defines the kind of data it holds.

Diese Übung ist Teil des Kurses

Introduction to Java

Kurs anzeigen

Anleitung zur Übung

  • Create a String variable called language that has the value of "Java".
  • Create a variable of type int called yearOfOrigin, that is set to 1995.

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

class InfoAboutJava {
	public static void main(String[] args) {
    	
        // Create a variable called language
        String ____ = "Java";
        
        // Create a variable called yearOfOrigin
        ____ ____ = 1995;

        System.out.println(language + " was created in " + yearOfOrigin);
    }
}
Code bearbeiten und ausführen