ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel

Top 50 Java Interview Questions You Shouldn't Miss.

Updated on December 16, 2015
lenodrow profile image

Leno Drow has been working as a freelance web developer and UX analyst for the past 4 years.

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.

Source

Instructions

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)

The 4 interview question types given below are subjective in nature and users need to answer them subjectively.

Java Interview Questions - Answers (subjective)

The given below are answers to the subjective Java interview questions. Candidates are requested to try to answer the questions by yourself before reading the answers.

#1 Java Frequently Asked Interview Questions - Live Test

view quiz statistics

#1 Java Frequently Asked Interview Questions

  1. What is the difference between JVM, JDK, JRE ?
  2. What are the different data types supported by Java?
  3. What is the advantage of Java architecture?
  4. What is a Just In Time Compiler or JIT ?
  5. What is the advantage of Java to an environment?
  6. What is an IDE ? Explain popular IDE with respect to JAVA.
  7. What is a Java exception ?
  8. What is the use of Dynamic Binding?
  9. Is it possible to use >> operator instead of >>> operator? Why?
  10. How to put a task to ready state?

#1 Answers - Java Frequently Asked Interview Questions

  1. 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.
  2. The different data types supported by the Java language are byte,short,int,long,float,double,Boolean and char.
  3. 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.
  4. 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.
  5. 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.
  6. IDE is the short for an Integrated Development Environment, Netbeans and Eclipse are the 2 popular IDE which are available for free.
  7. Java exceptions are Java conditions resulted from bad input and they are different from other Java conditions because they are recoverable.
  8. 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.
  9. No, both operators are different in the bit level.
  10. A task should follow a yield() method to put it to ready state.

#2 Java Freshers Interview Questions - Live Test

view quiz statistics

#2 - Java Interview Questions For Freshers

  1. Explain 4 different Object Oriented Programming Concepts.
  2. How to search for data using Java ?
  3. What is network programming ?
  4. What is TCP and UDP ?
  5. If a thread becomes dead, how can we restart it ?
  6. What is a Java Applet ?
  7. How threads are executed by Java ?
  8. Explain different methods available in the Java Thread class .
  9. Explain static methods available in the Java Thread class.
  10. Explain the Java collections framework.

#2 Answers - Java Interview Questions For Freshers

  1. Encapsulation, inheritance, polymorphism, and abstraction are the 4 different core object oriented programming concepts.
  2. Regular expressions can be used to search for data, Java provides the java.util.regex package for regular expressions.
  3. 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.
  4. TCP - Transmission Control Protocol, UDP - User Datagram Protocol. Both transmission protocols can be used to communicate effectively between applications over a network.
  5. It is not possible to restart a dead thread.
  6. A Java Applet is nothing but a Java application that can run in a web browser.
  7. Java threads are executed on the basis of their priority ranging from MIN_PRIORITY to MAX_PRIORITY.
  8. 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
  9. public static void yield(),public static void sleep,public static boolean holdsLock,public static Thread currentThread(),public static void dumpStack()
  10. 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 Test

view quiz statistics

#3 Java Interview Questions For Experienced

  1. How to fix a Null Pointer Exception?
  2. How to compare strings in Java?
  3. What is a raw type ?
  4. How to print a Java array ?
  5. How to parse JSON in Java?
  6. How to round a number in Java?
  7. What causes the ArrayIndexOutOfBoundsException ?
  8. What are the differences between public, private and protected in Java?
  9. How to create a text file in java?
  10. What is the use of Reflection in Java?


#3 Answers - Java Interview Questions For Experienced

  1. A Null Pointer Exception can be fixed by creating an object before declaring a variable.
  2. The "Objects.equals()" can be used to compare strings in Java.
  3. A raw type is a generic type declaration without any accompanying parameters.
  4. Print a java array using "System.out.println(Arrays.toString(array));"
  5. The org.json library can be used to parse JSON in Java.
  6. The "setRoundingMode" command can be used to round a number to the required number of decimal places.
  7. When an Array is accessed by an illegal index the "ArrayIndexOutOfBoundsException" is thrown by the system.
  8. 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.
  9. A new text file can be created using the "PrintWriter writer = new PrintWriter("name.txt", "UTF-8"); command.
  10. Reflection is the practice of using a code to inspect other codes inn the system.


Source

#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.


Source

#6 The Interview Checklist

view quiz statistics

Help Us Improve This Hub

Tell Us Who You Are

See results

© 2015 Leno Drow

Comments

    0 of 8192 characters used
    Post Comment

    No comments yet.

    working

    This website uses cookies

    As a user in the EEA, your approval is needed on a few things. To provide a better website experience, hubpages.com uses cookies (and other similar technologies) and may collect, process, and share personal data. Please choose which areas of our service you consent to our doing so.

    For more information on managing or withdrawing consents and how we handle data, visit our Privacy Policy at: https://hubpages.com/privacy-policy#gdpr

    Show Details
    Necessary
    HubPages Device IDThis is used to identify particular browsers or devices when the access the service, and is used for security reasons.
    LoginThis is necessary to sign in to the HubPages Service.
    Google RecaptchaThis is used to prevent bots and spam. (Privacy Policy)
    AkismetThis is used to detect comment spam. (Privacy Policy)
    HubPages Google AnalyticsThis is used to provide data on traffic to our website, all personally identifyable data is anonymized. (Privacy Policy)
    HubPages Traffic PixelThis is used to collect data on traffic to articles and other pages on our site. Unless you are signed in to a HubPages account, all personally identifiable information is anonymized.
    Amazon Web ServicesThis is a cloud services platform that we used to host our service. (Privacy Policy)
    CloudflareThis is a cloud CDN service that we use to efficiently deliver files required for our service to operate such as javascript, cascading style sheets, images, and videos. (Privacy Policy)
    Google Hosted LibrariesJavascript software libraries such as jQuery are loaded at endpoints on the googleapis.com or gstatic.com domains, for performance and efficiency reasons. (Privacy Policy)
    Features
    Google Custom SearchThis is feature allows you to search the site. (Privacy Policy)
    Google MapsSome articles have Google Maps embedded in them. (Privacy Policy)
    Google ChartsThis is used to display charts and graphs on articles and the author center. (Privacy Policy)
    Google AdSense Host APIThis service allows you to sign up for or associate a Google AdSense account with HubPages, so that you can earn money from ads on your articles. No data is shared unless you engage with this feature. (Privacy Policy)
    Google YouTubeSome articles have YouTube videos embedded in them. (Privacy Policy)
    VimeoSome articles have Vimeo videos embedded in them. (Privacy Policy)
    PaypalThis is used for a registered author who enrolls in the HubPages Earnings program and requests to be paid via PayPal. No data is shared with Paypal unless you engage with this feature. (Privacy Policy)
    Facebook LoginYou can use this to streamline signing up for, or signing in to your Hubpages account. No data is shared with Facebook unless you engage with this feature. (Privacy Policy)
    MavenThis supports the Maven widget and search functionality. (Privacy Policy)
    Marketing
    Google AdSenseThis is an ad network. (Privacy Policy)
    Google DoubleClickGoogle provides ad serving technology and runs an ad network. (Privacy Policy)
    Index ExchangeThis is an ad network. (Privacy Policy)
    SovrnThis is an ad network. (Privacy Policy)
    Facebook AdsThis is an ad network. (Privacy Policy)
    Amazon Unified Ad MarketplaceThis is an ad network. (Privacy Policy)
    AppNexusThis is an ad network. (Privacy Policy)
    OpenxThis is an ad network. (Privacy Policy)
    Rubicon ProjectThis is an ad network. (Privacy Policy)
    TripleLiftThis is an ad network. (Privacy Policy)
    Say MediaWe partner with Say Media to deliver ad campaigns on our sites. (Privacy Policy)
    Remarketing PixelsWe may use remarketing pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to advertise the HubPages Service to people that have visited our sites.
    Conversion Tracking PixelsWe may use conversion tracking pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to identify when an advertisement has successfully resulted in the desired action, such as signing up for the HubPages Service or publishing an article on the HubPages Service.
    Statistics
    Author Google AnalyticsThis is used to provide traffic data and reports to the authors of articles on the HubPages Service. (Privacy Policy)
    ComscoreComScore is a media measurement and analytics company providing marketing data and analytics to enterprises, media and advertising agencies, and publishers. Non-consent will result in ComScore only processing obfuscated personal data. (Privacy Policy)
    Amazon Tracking PixelSome articles display amazon products as part of the Amazon Affiliate program, this pixel provides traffic statistics for those products (Privacy Policy)