2.4_Understanding Data Types Flashcards
What are the two types categories of data in Java?
Primitive Types and Reference Types.
How many built-in data types Java has?
Java has eight built-in data types, referred to as the Java primitive types.
Which are the built-in data (primitive) types?
char | 16-bit Unicode value | ‘a’ | 0 to 65535
byte | 8-bit integral value | 123 | -128 to 127
short | 16-bit integral value | 25500 | -32768 to 32767
int | 32-bit integral value | 123 | -2,147,483,648 to 2,147,483,647
float |
long |
Is String a Primitive?
No, it is not. String is often mistaken for a ninth primitive because Java includes built-in support for String literals and operators.
Can reference types be assigned null?
Yes, which means they do not currently refer to an object.
Can primitive types be assigned null?
No, If you attempt to assign them null value, compiler will give you an error.
Which Data Type can call methods (Primitives | Reference)?
✅We can call a method on reference since it is of a reference type.
❌Primitives do not have methods.
Type names
Primitive types have lowercase type names.
All classes that come with Java begin with uppercase.