Interview questions on java for freshers/beginners

1.who developed Java?

Java was developed by Sun Microsystems by Patrick Naughton, Sheri Sheridan under the guidance of James Goslings.

2.In 1991 which platform independent software was developed?

oak was developed in 1991.

3.In which year first version of java was released ?

in the year 1995 the first version of java java 1.0 was released.

4.How java was influenced?

Java was influenced by many features of c++ .

5.Properties of java?

java is platform independent, portable and more secure .

6.what is jvm?

jvm stands for java vitual machine.jvm makes java able to run same program on different hardwares, operating systems.

7.Is java a fully object oriented language?

Java is assumed to be not a fully object oriented language as it support inheritance and polymorphism to some extent only.

8.which are the 7 basic concepts of oops.?







dynamic binding

9.what are objects and classes?

object:-objects are those which have properties,state and behaviour.

e.g.->human beings,we have colour,we have sense etc. properties.

classes:-classes are the blue prints of the objects, which explains the behaviour and properties of objects.

10.what is abstraction?

abstraction is a process providing only the essential information and hiding the background details.

for e.g.->Suppose a personal computer (pc’s) or laptops when can shut down and start them and can use internet and other softwares.But we dont need to

have knowledge about its internal mechanism or its internal details are not required to us .This is one of the example for abstraction.

11.What is encapsulation?

The wrapping up of data into single unit is known as encapsulation.

E.g.->Tv remote or keyboard.

12.what is Inheritance?

Inheritance is the concept which allows to extend a class with another class.

The ability of sub class acquiring the properties of super class is known as inheritance.

13.what is subclas sand super class?

super class: – the class whose properties can be acquired by another class called “superclass”.

Subclass: -the class who acquires the properties of another class known as “subclass.”

14.Types of inheritance?

There are five types of inheritance in Java:¬†–

Single inhertance: – The ability of an individual subclass to acquire the properties of the base class is known as “Single inheritance.”

Hierarchical inheritance: -more than one sub lass acquring properties of the base class.

multilevel inheritance:-
When a subclass is defined by a derived class concept known as multilevel inheritance.

It is a method where one or more inheritances are combined and used together.

Multiple: -In multiple inheritance subclass is derrived from more than one superclass.

15.disadvantages of inheritance?

classes are tightly coupled.

A minute change in superclass will affect the sublass.

If super class deleted,t he code will not work and now subclass will work independently.As classes coupled tightly, they can,t do work together.

16.What is polymorphism?

Polymorphism simply means that any organism or species may have different forms or stages. So, polymorphism is the ability of taking more than one form.

17.what are the types of polymorphism ?

run time polymorphism.

compile time polymorphism.

18.what is dynamic binding?
The property of object-oriented programming languages where the code executed to perform a given operation is determined at run time from the class of the operands.
19.what is message passing?

The transfer of information or communication between objects through which objects can send and receive information with another known as message


20.what is method overloading?

Method overloading is the process due to which we can define two or more methods sharing same name and class but their parameters declarations must

be different.This process helps in implementing process of polymorphism.

21.method overloading can exist in same class or not?

Yes, it can exist in same class.22.what is method overriding?

Method overriding allows a subclass or child class to provide a specific implementation of a method that is already provided by one of its superclasses or parent classes

23.What is dynamic binding ?

Dynamic binding is the property of object-oriented programming languages where the code executed to perform a given operation is determined at run time from the class of the operand(s).

24.Types of operators?

Tyes of operators are as follow:-









25.How many primitive data types are there in java?

Primitive data types in java are as follows:-

different types of control statements?



break statement

continue statement


while loop

do while loop

26.What is final?

final is a keyword used for constant declarations.It is used by method, class, and variable.

When used with variable make the variable constant.

When use with method, methods can’t be override for security reasons.27.what is finally?

finally keyword is used for exception handling.When we use finally in place of catch, it assures the guarranty of execution wheater a exception is thrown or not.

28.what is finalize?

finalize is a keyword used with garbage collector before collecting eligible objects.

29.what is interface?

Interface is neither a class nor an implementation , it only has parameters and method definition without body.

30.Diff. between abstraction and interface?

Interface do not provide any code determine only parameters while abstract class provides codes as well as details that have to be overridden.

Interface donot have modifiers for functions and properties while abstraction have modifiers for functions and properties.

speed of interface is slow in comparison with abstract classes.

Interface have no fields while absracts classes have fields.

31.Can We Create Object in interface?

Yes we can create objects in interfaces.

32.What are packages?

A package allows a developer to group classes (and interfaces) together. These classes will all be related in some way they might all be to do with a specific application or perform a specific set of tasks.

For e.g->channel package of dish tv.

33.what is a nested class?

Netsed class are those that are defined within another class and can have access to private members of the class in which they are present or reside.

34.Types of nested class?

two types:-

Static nested class:-these classes can access members of their ennclosing class indirectly through objects.

non-static:-These classes can access members of their enclosing class directly.

35.what is this keyword?

This keyword is used to point the current object.

36.what are arrays and its types?

array:-an array is a collection of same type of data into one single variable name.

types of array:-

1-d array.

2-d array.

37.what are strings and its types?

String:- An string is a set of characters.

types of string:-





strcpy etc.

38.what is exception handling?

exception is an error condition which ocurs in the code of a programwhile handling is use dto catch the error inside the source code.

39.what is serialization?

It is a process of saving a object state on a file in the local system.

40.what is synchronization?

synchronization is the process of sharing common resources or data among multiple threads so that only one can access that resource at a time.

41.what is applet?

an applet is a java program which runs on browser and for applet jvm is required.

42.what is swing?

Java provides an interactive features for design the GUIs toolkit or components like: labels, buttons, text boxes, checkboxes, combo boxes, panels and sliders etc. All AWT flexible components can be handled by the Java Swing.

43.what is mutithreading?

the ability of the operating system which allows working of the threads simultaenously without afecting the working of each other is known as mutithreading.

44.Java is portable explain?
Java programs are like “write once used anywhere which makes it protable.The primary condition required is the system must have jvm. is robust explain?
Memory allocation in java is more stronger as well as it has automatic garbage collector mechanism which makes it robust.