Common Interview Questions on Java

Java is a part of object oriented programming language and is a huge and practically important part of modern day programming. Java also consists of a vast array of conceptual titbits which often poses challenge. Generally a good interviewer starts asking questions regarding the basic knowledge about the subject and then they continue asking further questions based on your answers. Some common interview questions on java that are frequently asked in an interview are given below which includes java collections interview questions also.

Point out the difference among JVM, JDK and JRE?

java interview questions

 

  • JVM- It stands for Java Virtual Machine. JVM is a kind of abstract machine that gives an idea of the time during which the byte code of java can be carried out. Loading a code, verifying the code, then executing the code and finally providing the runtime environment for the code are the four main tasks that JVM performs. JVM is dependent on many software and hardware platforms.
  • JDK- It stands for Java Development Kit. It has physical existence and it contains JRE (Java Runtime Environment) and development tools like javac etc.
  • JRE- It stands for Java Runtime Environment. JRE usually gives an idea of the java runtime environment. Some set of libraries (rt.jar) and some files that are used by JVM during the run time usually make up a JRE. JRE is basically an application of JVM and it also has physical existence.

This is a very common java interview question for experienced candidates in an interview.

Another important java interview question and answer for experienced candidates is given below.

What is synchronization in respect to multi-threading?

In case of multithreading, there may occur situations where multiple thread requires access to the shared resources simultaneously. One way of handling that part of the problem is synchronization. It is strictly the capacity to control the access of more than one thread to the shared resources available or needed. Without synchronization, one thread may modify the value of a shared variable, and when the other thread receives the shared variable, it gets an updated value without its knowledge and it further modifies the value which would result in significant errors. In order to stop this from happening, synchronization is used.

Two very common interview questions on java that interviewers generally ask a candidate in an interview is regarding the platform used in java and the static method. The two questions are as follows:

Point out the main difference between Java platform and other platforms?

A Java platform is practically a software-based platform client, and it runs on top of all other hardware-based platform stints. It essentially consists of two components, one is the API that is the application programme environment and the other is the runtime environment.

What is static method?

A static method belongs to a class not to the object of the class. Without the need for creating the instance of the class, a static method can be invoked. Static method can also access static data member and can modulate the value of it, even change it.

Apart from all these questions, a very common java architect interview question is given below.

What are the steps to connect to database in Java?

The essential steps to connect to the database requires to register the driver class, creating the connection and the statements. After that the queries are needed to be executed, and after that the connection needs to be terminated. JDBC is needed for java to connect to the database.

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS
Comments (0)

Leave a Reply

Your email address will not be published. Required fields are marked *

Email
Print