Questions for the 1Z0-808 were updated on : Nov 14 ,2024
Given:
What is the result?
C
Which statement is true about the switch statement?
B
Given the code fragment:
What is the result?
D
Given the code fragment:
What is the result?
C
What is the name of the Java concept that uses access modifiers to protect variables and hide them
within a class?
A
Explanation:
Using the private modifier is the main way that an object encapsulates itself and hide data from the
outside world.
References:
Given the code fragment:
Which two modifications, made independently, enable the code to compile? (Choose two.)
C,D
Given:
And given the code fragment:
What is the result?
E
Given:
What is the result?
D
Given these two classes:
Any amount of electricity used by a customer (represented by an instance of the Customer class)
must contribute to the customer's bill (represented by the member variable bill) through the
useElectricity method.
An instance of the Customer class should never be able to tamper with or decrease the value of the
member variable bill.
How should you write methods in the ElectricAccount class at line n1 so that the member variable
bill is always equal to the value of the member variable kwh multiplied by the member variable rate?
A
Given the code fragment:
What is the result?
A
Given:
And given the code fragment:
Book book1 = new EBook();
book1.readBook();
Which option enables the code to compile?
D
Given:
What is the result?
C
Given:
Which code fragment should you use at line n1 to instantiate the dvd object successfully?
C
Given the code fragment:
Which option can replace xxx to enable the code to print 135?
B
Which statement best describes encapsulation?
A