Problem 11
Using Variables
Write a program that creates three variables: an int
, a double
, and a String
.
Put the value 113
into the first variable, the value 2.71828
into the second,
and the value "Computer Science"
into the third. It does not matter what you call the variables… this time.
Then, display the values of these three variables on the screen, one per line.
This is room # 113
e is close to 2.71828
I am learning a bit about Computer Science
Your program SHOULD NOT look like this:
System.out.println("This is room # 113");
System.out.println("e is close to 2.71828");
System.out.println("I am learning a bit about Computer Science");
You must use three variables. Your program will probably have nine lines of code inside the curly braces of the main()
method.
◄ 10: More Variables and Printing 12: Still Using Variables ►
Adapted from ProgrammingByDoing.com
©2013 Graham Mitchell
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.