Put what you've learned into practice. Declare variables for a student profile using the most appropriate type for each field.
Here's what you need to store:
- Student name (text)
- Age (whole number)
- GPA (decimal, like
3.85) - Letter grade (single character)
- Is currently enrolled (yes or no)
- Student ID number (could exceed billion)
Try writing the declarations yourself before looking at the solution:
String name = "Alice";
int age = 20;
double gpa = 3.85;
char grade = 'A';
boolean isEnrolled = true;
long studentId = 3000000001L;
If you picked different types, check your reasoning. Could age be a short? Technically yes, but int is the default choice for whole numbers. Using short to save bytes isn't worth the hassle.