Problem 12

Still Using Variables

Write a program that stores your name and year of graduation into variables, and displays their values on the screen.

Make sure that:

Also make sure that your variable names are descriptive: the name of a variable should always relate to its contents.

The template for your output will be:

My name is {name} and I'll graduate in {year}.

E.g.,

My name is Juan Valdez and I'll graduate in 2020.

In the correct code, the values "Juan Valdez" and 2020 will be stored in variables before printing.

You’re doing it wrong if your source code looks like this:

System.out.println( "My name is Juan Valdez and I'll graduate in 2020." );

◄ 11: Using Variables 13: Your Schedule ►



Adapted from ProgrammingByDoing.com
©2013 Graham Mitchell

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.