We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d60c427 commit f3dd384Copy full SHA for f3dd384
src/standard_input/other_types.md
@@ -21,4 +21,16 @@ void main() {
21
char grade = Character.parseCharacter(gradeString);
22
IO.println("You have a " + grade + " in the class.");
23
}
24
+```
25
+
26
+For characters specifically you can get the first character of a `String` with `.charAt(0)`,
27
+but you might also want to check that said `String` is only one character long. Each type
28
+will be special.
29
30
+```java,no_run
31
+void main() {
32
+ String gradeString = IO.readln("What is your letter grade? ");
33
+ char grade = gradeString.charAt(0);
34
+ IO.println("You have a " + grade + " in the class.");
35
+}
36
```
0 commit comments