Java Interview Questions and Answers for Freshers Pdf - 3

Question: 11

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.

Question: 12

What is method overloading and method overriding?

When a method in a class having the same method name with different arguments is said to be method overloading.

When a method in a class having the same method name with same arguments is said to be method overriding.

Question: 13

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.

Question: 14

What is protected?

It can be accessed in the same class, sub class of the same package but not other side of that package.

Question: 15

What is recursive?

A method that calls itself is said to be recursive.

Related Questions