Learn
How do we answer questions like: What grade did you get on the test? What letter does your name start with?
The char
data type can hold any character, like a letter, space, or punctuation mark.
It must be surrounded by single quotes, '
.
For example:
char grade = 'A'; char firstLetter = 'p'; char punctuation = '!';
Instructions
1.
Create a variable called expectedGrade
of type char
.
Fill it with a single letter, representing the grade you think you would get in a graded Java course where the grades A
, B
, C
, D
and F
are possible.
2.
Print out your expectedGrade
variable!
Take this course for free
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.