Creating a variable
Variables are like labeled boxes where you store data in your programs. Every variable in Java needs a name and a type that tells Java what kind of data it will hold. Let's create your first variables!
Deze oefening maakt deel uit van de cursus
Introduction to Java
Oefeninstructies
- Create a text variable called
languagethat has the value of"Java". - Create a numerical variable called
yearOfOriginthat is set to1995.
Praktische interactieve oefening
Probeer deze oefening eens door deze voorbeeldcode in te vullen.
class InfoAboutJava {
public static void main(String[] args) {
// Create a text variable called language
String ____ = "Java";
// Create a numerical variable called yearOfOrigin
____ ____ = 1995;
System.out.println(language + " was created in " + yearOfOrigin);
}
}