Java Interview Questions and Answers - 2

Question: 6

What is the difference between a public and non public class?

A public class may be accessed outside of its package.

A non public class may not be accessed outside of its package.

Question: 7

What is the purpose of the System class?

The purpose of the System class is to provide access to system resources.

Question: 8

What is a JVM consists of?

Each time of a Java Application is executed then an instance of JVM, responsible for its running, is created.

A JVM instance is described in terms of subsystems, memory areas, data types, and instructions.

Question: 9

What are the different types of casting?

There are two types of casting

Casting between primitive numeric types

Casting between object references.

Casting between numeric types is used to convert larger values into smaller values. For e.g. double values to byte values.

Casting between object references helps you refer to an object by a compatible class, interface, or array type reference.

Question: 10

What is Downcasting?

Downcasting means creating from a general to a more specific type.

Related Questions