Slides First Steps Primitive Types
Slides First Steps Primitive Types
n
We've been working only with the int data type so far in the course.
In this video, we'll continue to look at int, as well as several other primitive types.
We'll also introduce the wrapper class, a special category of data type, which offers
additional functionality that primitive types don't.
byte
short float
int double
long
char boolean
You can see there, that in general, it's pretty easy to remember the wrapper class name,
for your primitive data type. It's the same name, but with an uppercase letter at the start.
The wrapper classes for char and int, Character and Integer respectively, are the only two
that differ in name (other than that first capitalized letter) from their primitive types.
To discover the minimum and maximum range of numbers, that can be stored in an
int, as we saw when we printed out these values previously:
If you assign a numeric literal value to a data type that is outside of the range, the
compiler DOES give you an error. We looked at a similar example previously.
You can put the underscore anywhere you might want a comma, but you can't use
an underscore at the start or end of the numeric literal.