Basic Java Interview Question and Answers
21. | What are wrapper classes? |
---|---|
Wrapper classes are classes that allow primitive types to be accessed as objects. | |
22. | What is the difference between overloading and overriding? |
---|---|
|
|
23. | Immutable objects are automatically thread-safe? |
---|---|
True. Since the state of the immutable objects cannot be changed once they are created they are automatically synchronized/thread-safe. | |
24. | Does Java provide any construct to find out the size of an object? |
---|---|
No there is not sizeof operator in Java. So there is not direct way to determine the size of an object directly in Java. | |