Declaring and Initializing a Char Variable
Consider the following code segment.
public class CharDemo {
public static void main(String[] args) {
/* missing statement */
System.out.println(grade);
}
}
Which of the following can replace /* missing statement */ to correctly declare a char variable named grade and initialize it with the value 'C'?
A
char grade = C;
B
char grade = “C”;
C
char grade = ‘C’;
D
String grade = ‘C’;
Question Leaderboard
| Rank | |||||
|---|---|---|---|---|---|
| #1 | Potter16 | 1 | 1 | 0m 07s | 93 |
| #2 | Wilbert.Ankomah27 | 1 | 1 | 0m 12s | 88 |
| #3 | bommasam000 | 1 | 1 | 0m 12s | 88 |
| #4 | busemagngr | 1 | 1 | 0m 38s | 62 |
| #5 | patrickmeijer009 | 1 | 3 | 0m 32s | 48 |
| #6 | y.seong2027 | 1 | 1 | 0m 53s | 47 |
| #7 | 6test6ing6 | 0 | 1 | 0m 00s | -10 |
| #8 | vld8kitty | 0 | 1 | 0m 45s | -55 |
| #9 | lsj08030922 | 1 | 2 | 15m 00s | -810 |
| #10 | parth.taur227 | 2 | 2 | 1h 46m | -6,165 |
Items per page:
10
1 – 10 of 10
