Before starting your job search, look at these common Java interview questions asked during real interviews and understand the answers, but instead of memorizing the answers try to complete further research and come with your own personal solution for the interview question. The more prepared you are for what you will encounter, the more successful you will be. This collection of Java interview question could be also useful for software developers who need to interview Java developer.

SQL interview questions for Java developer

There are SQL interview questions for Java developer, because Java applications come in different shapes and sizes. The application could be just servlet based web application or it could use application frameworks like Spring or Struts. All enterprise Java applications have a common approach: they store data in a database like MS SQL, Oracle SQL or MySQL and use some framework to interact with that database. That framework ultimately translates the interaction into SQL statements, and those SQL statements need to be written by Java developer.

Every Java Developer resume indicates that developer has the database experience, an interviewer will definitely ask engineer a few common SQL interview questions to determine the depth of the knowledge in database area. The interviewer might use common database interview questions to decide whether interviewee have ever used T-SQL,PL/SQL or MySQL before or whether tailored the resume for an open Java developer position.

Without further ado, here they are SQL interview questions for Java Developer :

Beginner Level
Given an employees table with the columns EmpID, FirstName, LastName, StartDate, and EndDate:
Develop SQL query to return all employees currently working with last names starting with "Jon" sorted by last name then first name.

Easy Level
Using the same Employee table, plus a new table "PerformanceReviews" with the columns EmpID, and ReviewDate:
Develop SQL query to return the list of all employees who have never had a review sorted by StartDate.

Medium Level
Using the same Employee table, develop SQL query to show the difference in days between the most and least tenured employee currently working?

Hard Level
Working with Employee table, develop SQL query to print the longest period in days that the company has gone without headcount change.


On this page I put some SQL interview questions for Java Developer. These database interview questions are very simple and mainly were used to for interviewing Java developers to identify the total vacuum in database technology. The developer can find more database interview questions online or by buying one of the top recommend books for SQL interview preparation. Depending on the SQL flavor you're dealing with, take a look on MS SQL Server Interview Questions book or ORACLE PL/SQL Interview Questions book.

Java Interview Question 9: What do you think of the future of Java?

As an open-ended interview question I like to ask both beginner and experienced Java Developer about Java future. The short version of one of the answers may sound like this:

Java platform, JVM and JDK, will certainly continue have the same importance it had in the past and will most likely maintain its position of most popular platform for software development for a long time. Groovy, Selenium, Jython, Scala and Clojure has obviously been booming during the last couple of years. Android platform is giving a major boost to Java in the mobile space. There are a massive array of open source and commercial libraries for Java. Even if major users of Java will decide to code all the existing Java application and systems to another language, it would take more than several years to replace it all. In the near term Java is safe investment and will remain highly relevant for a long time to come.

Java Interview Question 8: When to use private constructor?

Usually Java interview questions for developers with 2 year experience, 3 year experience do not include basic questions like explaining difference between JDK and JRE or naming four access level modifiers in Java. I bet every beginner Java developer could name them as public, protected, default and private and most likely would remember that a constructor can use all four access modifiers. In the same time I would not except a beginner to answer on one of the must know Java interview questions after 2 years of experience - when to use private constructor? I hope to hear the following answer:
  • Private constructor is used if Java software developer does not want other classes to instantiate the object and to prevent class inheritance.
  • The instantiation could be done by providing a public static method, as is done when using Singleton Design Pattern or Factory Method Pattern.

Java Interview Question 7: What is final finally finalize difference?

Java interview question about final, finally, and finalize is a straightforward question and software developer with an experience should not blabber on about a problem, but should stay light on details and just state the key points.

Final

When Final is applied to a class: The class cannot be subclassed.
public final class FinalClassExample {...}

When Final is applied to a method: The method cannot be overridden.
public class MyClass {
public final void FinalMethodExample() {...}
}

When Final is applied to a variable primitive or reference: The value of the variable cannot change or cannot point to any other object on the heap.

public class FinalVariableExample {
public static void main(String[] args) {
final int minutesInHour=60;
}
}


Finally
“Finally” is an optional block called after “try” block or after “catch” block. Statements in the finally block will always be executed (except when System.exit() is called in "try" or "catch" blocks).

try {
  // regualr execution path
} catch (SampleException ee) {
  //  handle SampleException
} finally {
  // This optional section is executed upon termination of any of the try or catch blocks above,
  // except if JVM exits from the try or catch blocks
}

Finalize()
This is the method that the JVM runs before running the garbage collector. Before an object is garbage collected, the runtime system calls its finalize() method.

protected void finalize() throws Throwable {
   . . .
   // clean up code for here
   . . .
   super.finalize();
}

This is must know Java interview question after two years of software development experience with Java.

Java Interview Question 6: Explain JVM memory structure?

Some Java software developers think that they do need to know about JVM memory structure and wrongly assume that Java code written by them will always work if they were able to compile and run the application at least once. Unfortunately this is not a true, so the interviewer should always ask at least one question on JVM memory structure and tuning. The interviewer would expect that software programmer should be able to explain the segments of JVM memory. There are two of them: heap memory and non-heap memory. Heap memory is the storage for Java objects and sometimes it is called as shared memory, because multiple threads will share the same data in heap memory. The heap memory may be of a fixed or variable size. Non-heap memory is a memory other than the heap memory and also could be a fixed or variable size. Non-heap memory stores per-class structures such as runtime constant pool, static fields and method data, and the code for methods and constructors. Keep in mind that JVM implementation may require memory for internal processing or optimization which also seats in non-heap memory.

Java Interview Question 5: What is JVM?

The Java Virtual machine (JVM) is the implementation of abstract definition of the Java Virtual Machine Specification. JVM is the application required for execution of a Java applications and programs. There are multiple implementation of JVM by different vendors. For example, JRockit JMV Oracle, I9 JVM IBM and HotSpot JVM (née Sun) Oracle. JVM is primarily aimed at executing Java applications, but many other languages can run on top of it. For example the implementation of existing languages - Resin (PHP), Jython (Python), JRuby (Ruby).

Related questions:
  • How to check if JVM is available on a computer?
  • How to check the JVM version?
jvm version

Java Interview Question 4: What is the difference between JRE and JDK?

Ask a simple java interview question, such as what is JRE and JDK? (a legitimate interview question) and you still will get a few incorrect answers. Apparently even Senior Java developers sometimes being confused about the functionality of JRE and JDK.

What is JRE?

JRE is Java Runtime Environment. It is obviously JVM (Java Virtual Machine), core libraries and other additional components requried to run applications and applets written in Java programming language.

What is JDK?

JDK is Java Software Development Kit, it includes JRE, compilers and tools to create, compile and debug Java programs.

Both JRE and JDK are basically a bunch of directories with Java related files, but JRE is smaller than JDK. Any user who wants to run applets and applications written using Java need JRE, while Java software developer who create applets and applications need JDK.