Top 50 Java Interview Questions You Shouldn't Miss.
Intro to Java Interview Questions and Answers.
Java is a programming language which marked itself in the history of computer programming languages. Java unlike other high level programming languages is flexible and expandable, this vast features of Java makes it difficult for students or interviewee to tackle a Java interview. Without further thoughts we can say that Java interview questions and answers are very helpful for any candidate who needs to attend an interview focused around the Java Programming language .
But a single source of questions like books won't help you tackle the Java game. So in order to cover these vast pockets of Java and win the interview game, we used different sources including Java support forums, Java community websites, previous interview questions etc to make Java interview questions which are close to practice rather than theory.
We have spend more than 120 hours to make these Java interview questions and answers and hope these questions and answers will help you easily tackle the interview .
The interview questions and answers are applicable for both freshers and experienced Java professionals (7-10 years)
Congratulations for your interview in advance.
This Hub contains both subjective and objective questions and the interviewee are advised to take the objective test first before answering the subjective questions to analyse your level of expertise. When attending the subjective questions, candidates must write down the questions in a notebook and answer the the questions within 30 minutes or a maximum of 60 minutes .
After completing the subjective questions users can check their answers with the answers given in this Hub. The answers do not need to match but should point in the same direction.
Table of Contents
This Hub is divided into different sections based on the experience level of the interviewee or the candidate. All sections contain 10 to 100 questions and answers which are subjective and an objective questionnaire which can be used to check your present knowledge level.
Java Interview Questions - Live Test (objective)
The 4 interview question types given below are objective in nature and users need to select the correct answer to complete the questionnaire.
Java Interview Questions (subjective)
Java Interview Questions - Answers (subjective)
#1 Java Frequently Asked Interview Questions - Live Testview quiz statistics
#1 Java Frequently Asked Interview Questions
- What is the difference between JVM, JDK, JRE ?
- What are the different data types supported by Java?
- What is the advantage of Java architecture?
- What is a Just In Time Compiler or JIT ?
- What is the advantage of Java to an environment?
- What is an IDE ? Explain popular IDE with respect to JAVA.
- What is a Java exception ?
- What is the use of Dynamic Binding?
- Is it possible to use >> operator instead of >>> operator? Why?
- How to put a task to ready state?
#1 Answers - Java Frequently Asked Interview Questions
- The JVM or the Java Virtual Machine runs the code, the JRE and JDK are both development environments but the JDK or the Java Development Kit is more advanced than JRE or Java Runtime Environment because of the presence of additional tools like compilers and debuggers in the JDK.
- The different data types supported by the Java language are byte,short,int,long,float,double,Boolean and char.
- The advantage of Java architecture over other programming languages is that it has a neutral architecture. Java makes it possible to run its code on different machines of different architecture with the help of its compiler and JRE (Java Runtime Environment). Java can be run on both x86 and ARM devices due to its neutral architecture.
- Normally high level programming languages are slow due to the distance it keeps from the processor which finally executes the code. Java uses the JIT or Just In Time Compiler to convert the Java codes into processor instructions which reduces the overall execution time by making it easier for the processor to execute the codes. This feature of Java makes it faster over other high level programming languages.
- An environment which gets developed over time requires the programs to change the code according to the new environment. Java makes it extremely easier to update the program codes with the help of its huge library, programs can auto update the code by considering different environmental factors.
- IDE is the short for an Integrated Development Environment, Netbeans and Eclipse are the 2 popular IDE which are available for free.
- Java exceptions are Java conditions resulted from bad input and they are different from other Java conditions because they are recoverable.
- In Java if a code needs to be executed when a call is made, a linking procedure called Binding is needed. If the code that needs to be executed when a call is made is unknown until the time of call then Dynamic Binding is required.
- No, both operators are different in the bit level.
- A task should follow a yield() method to put it to ready state.
#2 Java Freshers Interview Questions - Live Testview quiz statistics
#2 - Java Interview Questions For Freshers
- Explain 4 different Object Oriented Programming Concepts.
- How to search for data using Java ?
- What is network programming ?
- What is TCP and UDP ?
- If a thread becomes dead, how can we restart it ?
- What is a Java Applet ?
- How threads are executed by Java ?
- Explain different methods available in the Java Thread class .
- Explain static methods available in the Java Thread class.
- Explain the Java collections framework.
#2 Answers - Java Interview Questions For Freshers
- Encapsulation, inheritance, polymorphism, and abstraction are the 4 different core object oriented programming concepts.
- Regular expressions can be used to search for data, Java provides the java.util.regex package for regular expressions.
- Computer networking means connecting different computers together using wired or wireless methods. Network Programming is used to write programs that can execute in a network.
- TCP - Transmission Control Protocol, UDP - User Datagram Protocol. Both transmission protocols can be used to communicate effectively between applications over a network.
- It is not possible to restart a dead thread.
- A Java Applet is nothing but a Java application that can run in a web browser.
- Java threads are executed on the basis of their priority ranging from MIN_PRIORITY to MAX_PRIORITY.
- public void start(),public void run(),public final void setName,public final void setPriority,public final void setDaemon,public final void join,public void interrupt,public final boolean isAlive
- public static void yield(),public static void sleep,public static boolean holdsLock,public static Thread currentThread(),public static void dumpStack()
- Different collections are unified into a single platform called the collections framework. All collections framework can contain Interfaces,Implementations and Algorithms.
#3 Java Experienced Interview Questions - Live Testview quiz statistics
#3 Java Interview Questions For Experienced
- How to fix a Null Pointer Exception?
- How to compare strings in Java?
- What is a raw type ?
- How to print a Java array ?
- How to parse JSON in Java?
- How to round a number in Java?
- What causes the ArrayIndexOutOfBoundsException ?
- What are the differences between public, private and protected in Java?
- How to create a text file in java?
- What is the use of Reflection in Java?
#3 Answers - Java Interview Questions For Experienced
- A Null Pointer Exception can be fixed by creating an object before declaring a variable.
- The "Objects.equals()" can be used to compare strings in Java.
- A raw type is a generic type declaration without any accompanying parameters.
- Print a java array using "System.out.println(Arrays.toString(array));"
- The org.json library can be used to parse JSON in Java.
- The "setRoundingMode" command can be used to round a number to the required number of decimal places.
- When an Array is accessed by an illegal index the "ArrayIndexOutOfBoundsException" is thrown by the system.
- The only difference between the public and protected is that the "world" is not accessible in the protected mode. In private only the "class" is accessible.
- A new text file can be created using the "PrintWriter writer = new PrintWriter("name.txt", "UTF-8"); command.
- Reflection is the practice of using a code to inspect other codes inn the system.
#5 Dress Code For The Java Interview
- Dress according to your profession
- Wear clean or new clothes
- Avoid perfumes
- Wear suits if possible .
- Avoid bright colors.
- Make sure your hair is neat.
- Take a bath in the morning or few hour before the interview to keep fresh.
- Check your breath.
- Sleep well the day before interview to prevent fatigue.
#6 The Interview Checklistview quiz statistics
Help Us Improve This Hub
Tell Us Who You Are
© 2015 Leno Drow