A Value-Based class is a Java class that wraps a value. All the wrapper classes (Byte, Short, Integer, Long, Character, Float, Double, and Boolean) in Java are Value-Based classes, as they wrap the primitive type. In addition to the wrapper classes, the Optional class and the Date and Time API classes are also Value-Based classes.
A Value-Based class contains final fields and does not contain accessible constructors.
Which of the following statements is NOT true about Value-Based classes?
a) The class uses the instance's monitor to perform synchronization
b) If accessible constructors are created, they should be marked deprecated
c) The class should be instantiated only by using a factory method
d) The Value-Based class is always final
Created by Nancy K.A.N.
@22:22 06-Jul-2025
Follow on YouTube Coding With Nancy
No comments:
Post a Comment