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!
This exercise is part of the course
Introduction to Java
Exercise instructions
- Create a
String
variablecreator
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 creator variable
String ____ = ____;
System.out.println(language);
System.out.println(yearOfOrigin);
// Print the creator of Java
System.out.println(____);
}
}