Java Interview Questions and Answers for Freshers Pdf - 1

Question: 1

What are class, constructor and primitive data types?

Class is a template for multiple objects with similar features and it is a blue print for objects. It defines a type of objects according to the data the object can hold and the operations the object can perform.

Constructor is a special kind of method that determines how an object is initialized when created.

Primitive data types and 8 types and they are

byte, short, int, long

float, double, boolean, char

Question: 2

What is an interface?

It is a task for specific contract.

It does not actually define any implementations.

It is not all a class. It won’t allow constructors.

Question: 3

What is recursion?

It is a process of defining something in terms of itself.

Question: 4

What is static?

Static is the keyword, which is used to create a member that can be used by itself. Without reference to a specific instance.

It is a class level variable. It is illegal to refer to any instance variables inside of a static method.

Question: 5

What are methods?

Methods are functions that operate on instances of classes in which they are defined. Objects can communicate with each other using methods and can call methods in other classes.

Method definition has four parts. They are name of the method; type of object or primitive type the method returns, a list of parameters and the body of the method. A method’s signature is a combination of the first three parts mentioned above.

Related Questions