Recall & Review
beginner
What are primitive data types in Java?
Primitive data types are the most basic data types built into the Java language. They store simple values like numbers, characters, and true/false values directly in memory.
Click to reveal answer
beginner
Name the 8 primitive data types in Java.
The 8 primitive data types are: byte, short, int, long, float, double, char, and boolean.
Click to reveal answer
beginner
What is the difference between
int and long in Java?int stores 32-bit integer values, while long stores 64-bit integer values. Use long when you need to store bigger whole numbers.Click to reveal answer
beginner
Which primitive data type would you use to store a single character?
Use the
char data type to store a single character, like a letter or symbol. It uses 16 bits and stores Unicode characters.Click to reveal answer
beginner
What values can a
boolean hold in Java?A
boolean can hold only two values: true or false. It is used to represent simple yes/no or on/off states.Click to reveal answer
Which of these is NOT a primitive data type in Java?
✗ Incorrect
String is not a primitive type; it is a class in Java. The others are primitive data types.
What is the size of a
float in Java?✗ Incorrect
A float uses 32 bits to store decimal numbers.
Which primitive type would you use to store the value
true?✗ Incorrect
boolean stores true or false values.
What is the default value of an
int variable in Java?✗ Incorrect
The default value of an int is 0 when declared as a class member.
Which primitive type can store the largest range of whole numbers?
✗ Incorrect
long stores 64-bit integers, which is the largest range among integer primitives.
Explain what primitive data types are in Java and list all of them.
Think about simple values like numbers and true/false.
You got /2 concepts.
Describe when you would use
int versus long in Java.Consider the size in bits and the range of values.
You got /2 concepts.