Interview Questions on JAVA

Jan 12 • Resources • 7403 Views • 1 Comment on Interview Questions on JAVA

Question 1- What are the two paradigms for Object Oriented Programming?
Answer- The two paradigms for Object Oriented programming are as follows :-

1. Process oriented It can be thought of as code acting on data. Example is C language
2. Object oriented It can be thought of as data controlling access to code. Example is Java

Java

JAVA Training

Question 2-What are the Features of Java?
Answer- The features of this programming language are as follows-
1. Simple and Secure.
2. Portable and Robust.
3. Machine Independent.
4. Multithreaded.
5. Distributed and Dynamic.

Question 3- Why Java is a strongly typed language?
Answer- It is a strongly typed language because :-

1. Every variable and expression has a strongly defined type.
2. All assignments are checked for type compatibility.

Question 4- Draw a diagrammatic representation of Java?
Answer- Architecture can be represented as:-

Java Architecture

Architecture of JAVA

Question 5- What do you mean by Java Applet?
Answer- An applet is a special kind of Java program that is designed to be transmitted over the internet and automatically executed by a Java compatible web browser . They are downloaded on demand without interacting with user. The following figure explains loading and start-up of an applet.

Java Training

Java Applet

Question 6- How will you define packages in java?
Answer- A package is a mechanism for organising the classes. They can be stored in compressed files called JAR files . The Packages in this general purpose language have following features :-

1. Package provides a unique namespace for the types it contains.
2. Classes in the same package can access each others package / access members.

Question 7– Explain Run-time polymorphism in Java?
Answer-
When a method of the same name and signature is included in both super and subclasses then the method in the subclass is said to override the method in superclass.

Question 8-What do you mean by Multithreaded programming in Java?
Answer- A multithreaded program contains two or more parts that can run concurrently. Each of these part is known as a thread which is the smallest unit of dispatchable code. Each thread defines a separate path of execution.

JAVA Courses

Multithreading

Question 9- Explain the concept of For Each loop in Java?
Answer- It is also known as Enhanced for loop. It is implemented without using no other keyword. The journal structure of for each loop is
syntax :
for(type iteration variable: collection)
{
statement block
}
For example-
int nums[ ] = {1,2,3,4,5,6};
int sum=0;
for(int x: nums)
{
sum += x;
}

Question 10-Explain the concept of Exception handling in Java?
Answer- An exception is an abnormal condition that arises in a code sequence at run-time. In this, the exception can also be handled by user by using following five keywords :
Try, Catch, Finally, Throw, Throws

Exception hierarchy can be understand by the following diagram :

JAVA Coding

Exception hierarchy

If you like to have questions and answers for this programming language for your interviews and references in pdf, click here  QUESTIONS AND ANSWERS ON JAVA.pdf

Please write some questions and queries about this most used programming language in the comments below this article.

Related Links-
Interview questions on JAVA
Sample Interview questions on JAVA
Solved Interview Questions of JAVA…..
Sample Paper for Java Programming Language

Tell us Your Queries, Suggestions and Feedback

Your email address will not be published.

One Response to Interview Questions on JAVA

  1. Vipin Sahu says:

    This post contains important and valuable questions of java for an interview. These questions help to crack interview round in placements and other examination.

« »