Java Interview Questions and Answers - 3

Question: 11

What is the difference between implicit and explicit type casting?

An explicit conversion is where you use syntax to tell the program to do a conversion whereas in case of implicit type casting you need not provide the data type.

Question: 12

What is meant by abstract interface?

First, an interface is abstract. That means you cannot have any implementation in an interface.

All the methods declared in an interface are abstract methods or signature of the methods.

Question: 13

How to create an immutable class?

  • To create an immutable class following steps should be followed.
  • Create a final class
  • Set the values of properties using constructor only
  • Make the properties of the class final and private
  • Do not provide any setters for these properties.

Question: 14

Which class is extended by all other classes?

The Object class is extended by all other classes.

Question: 15

Can an abstract class be final?

An abstract class may not be declared as final.

Related Questions