Java Reference
In-Depth Information
Review Questions
1.
Which two Java keywords have no implementation and cannot be used in Java?
2.
A boolean in Java can only be assigned to which two special literals?
3.
True or False: main is a Java keyword.
4.
True or False: An identifier must begin with a letter, underscore, or dollar sign.
5.
Name the eight primitive data types in Java and give their size in bits.
6.
True or False: You can use the unsigned keyword to make an int store all positive
values.
7.
If you need to create a new data type beyond the eight built-in types, you need to
write a(n) _________________.
8.
True or False: The size of an int depends on the underlying platform that the Java pro-
gram is running on.
9.
What Java keyword is used to declare a constant?
10.
A string literal in Java is automatically instantiated into what data type?
11.
True or False: String objects in Java are immutable.
12.
In Java, a variable is either one of the eight primitive data types or a(n)
____________________.
13.
True or False: A reference in Java contains the memory address of an object, but there
is no way for you to view or access that memory address.
14.
If x is an int equal to 25, what will x be after the statement x /= 4?
15.
If b is a byte equal to -24, what is the result of b >> = 2?
16.
Assuming that x is 10, what will y be after the statement y = (x > 0) ? 1 : 2; ?
17.
Name the three techniques in Java used to add comments to source code.
Search WWH ::




Custom Search