Java Foundations 2 Flashcards
What are the primitive data types in Java?
The primitive data types in Java are byte, short, int, long, float, double, char, and boolean.
True or False: Numeric literals can include underscores for better readability.
True
Fill in the blank: The _______ type is used to represent a single 16-bit Unicode character in Java.
char
Which of the following is NOT a primitive data type? (a) int (b) String (c) boolean
b) String
What is the purpose of using underscores in numeric literals?
Underscores in numeric literals improve readability by separating groups of digits.
Short Answer: What is the maximum value of a byte in Java?
The maximum value of a byte in Java is 127.
True or False: String is a primitive data type in Java.
False
Fill in the blank: The data type used to represent true/false values in Java is _______.
boolean
What is the syntax to declare a String variable in Java?
String variableName = “value”;
Multiple Choice: Which of the following correctly uses underscores in a numeric literal? (a) 1000 (b) 1000 (c) 1__000
(a) 1_000