Java OOPS Interview Questions for 3 years experienced - 1

Question: 1

What are the differences between JIT and Hotspot?

The Hotspot VM is a collection of techniques, the most significant of which is called adaptive optimization.

The original JVM interpreted byte codes one at a time. Second generation JVMs added a JIT compiler, which compiles each method to native code upon first execution, then executes the native code. thereafter, whenever the method is called, the native code is executed. The adaptive optimization technique used by Hotspot is a hybrid approach, one that combines byte code interpretation and run time compilation to native code.

Hotspot, unlike a regular JIT compiling VM, doesn’t do premature optimization.

Question: 2

What is inheritance?

Inheritance is the process of inheriting all the features from a class.

The advantages of inheritance are reusability of code and accessibility of variables and methods of the super class by subclasses.

Question: 3

What is interface?

Interface is similar to a class which may contain method’s signature only but not bodies and it is a formal set of method and constant declarations that must be defined by the class that implements it.

Interfaces are useful for:

Declaring methods that one or more classes are expected to implement

Capturing similarities between unrelated classes without forcing a class relationship

Determining an object’s programming interface without revealing the actual body of the class.

Question: 4

What is numeric promotion?

Numeric promotion is the conversion of a smaller numeric type to a larger numeric type, so that integer an floating point operations may take place.

In numerical promotion, byte, char an short values are converted to int values.

The int values are also converted to long values, if necessary.

The long and float values are converted to double values, are required.

Question: 5

Does a class inherit the constructors of its superclass?

A class does not inherit constructors from any of its superclass.

Related Questions