Explore jobs
Find specific jobs
Explore careers
Explore professions
Best companies
Explore companies
When a developer achieves a senior level, usually with five or more years of experience, the interview questions for a core Java programmer or developer become more advanced than they are for beginners.
Applicants interviewing for a job as a senior Java developer should have strong technical, problem-solving, and critical thinking skills and the most important examples listed in a resume should reflect these traits when an interviewer says, “walk me through your resume.”
Usually, a bachelor’s degree in computer science or a related field is required in addition to years of industry experience, although some employers may be looking for further education. These same prime resume points will likely serve well in a graduate school resume as well.
Looking for a job? These position are hiring now near you:
Java is a programming language that is class-based and object-oriented. It’s designed to have as few implementation dependencies as possible, and it’s one of the most exciting jobs for current or former senior software engineers.
Senior developers with years of Java experience are expected to have the knowledge and communication skills to instruct and mentor other developers.
If you’re interested in this type of job, you should be prepared for typical interview questions, such as “What is your greatest accomplishment?”
And you should already have basics such as data structure, algorithms, and object-oriented programming topics under your belt, but be prepared for these questions to be more complex with answers that need to be thorough and detailed.
Whether you’re interviewing for a new job or seeking a promotion within your current workplace, here are some of the questions and topics you need to be able to quickly and easily answer:
Why is Java called the “Platform Independent Programming Language?”
Java was designed with versatility in mind. Its application programs can run on any platform without requiring a programmer to rewrite or recompile the data for each separate platform.
What is JVM?
JVM stands for “Java virtual machine” and is a process virtual machine capable of executing Java bytecode. Each Java source file is compiled into a bytecode file. A JVM is what makes Java so versatile because as it executes the bytecode file, it’s aware of the specific instruction lengths and other necessities of any underlying hardware platform.
What is Spring?
In the technical sphere, Spring is an open-source development framework used for enterprise Java. While the core features of the Spring framework are compatible with developing any Java application, special extensions exist for building separate web applications on top of the Java EE (Enterprise Edition) platform.
Spring framework promotes a POJO (Plain Old Java Object) programming model, which is considered to be good programming practice and also makes J2EE (Java 2 Enterprise Edition) development easier to use.
What is the difference between JDK and JRE?
The Java Runtime Environment (JRE) is essentially the JVM where Java programs are being executed. The JRE also includes browser plugins.
The Java Development Kit (JDK) is the full-featured software development kit for Java. It includes the JRE in addition to compilers and tools such as JavaDoc and Java Debugger that allow a user to develop, compile, and execute Java applications.
What are Spring beans?
Beans are the objects that form the backbone of an application and are managed by the Spring IoC container. Beans are created with the configuration metadata that is supplied to the container. An example would be XML definitions.
What are some of the benefits of using Spring?
Here are a few acceptable answers to this question:
Lightweight. The basic version of the Spring framework is around 2MB, making Spring lightweight in terms of size and transparency.
Inversion of Control (IoC). Spring uses the technique of IoC to achieve loose coupling and give objects their dependencies instead of creating or searching for dependent objects.
Container. Spring manages and contains the configuration of application objects, as well as their life cycles.
Aspect Oriented (AOP). Spring supports Aspect-oriented programming. It also separates application business logic from system services to enable cohesive development.
MVC framework. Spring utilizes a well-designed MVC framework that is efficient and popular in comparison to other types of web frameworks.
Transaction management. Spring’s consistent management interface can be scaled up or down for global and local transactions.
Exception handling. Spring’s application programming interface (API) translates technology-specific exceptions into consistent, unchecked exceptions.
What do system.gc() and runtime.gc() methods do?
Both of these methods can be used as a hint to the JVM to start a garbage collection. It is, however, up to the JVM to start the collection immediately or at a later time.
What is application context?
An application context is similar to a bean factory in that both are capable of loading definition, wiring beans together, and dispense beans upon request. But an application context also has additional functions, including a generic way to load file resources, a means for resolving text messages, and events to beans that are registered as listeners.
What is JDBC?
JDBC is an abstraction layer. It allows users to choose between databases and enables developers to write database applications in Java without the need to worry about the underlying details of specific databases.
What is reflection?
Reflection describes code that can inspect other code in the same system and make modifications at runtime.
What is the function of Continuous Integration (CI) server?
CI server function continually checks for compile errors and integrates all of the changes committed to the repository by different developers. It must build code multiple times a day, preferably after every commit so it can detect breakage and identify which commit was the cause.
What is the relationship between a class and an object?
A class defines the properties, states, and behaviors common to several objects, similar to a blueprint. An object is an instance of a class.
For example, think of “canine” as a class. Objects within that class can include wolves, dogs, foxes, coyotes, et cetera.
Can == be used on enum?
Yes. Enums have tight instance controls, which allows you to use == to compare instances.
Compare the sleep() and wait() functions in Java.
sleep() is a blocking operation. It will keep a hold on the monitor and lock the shared object for a set number of milliseconds.
wait() pauses the thread until the specified number of milliseconds has passed or it receives a notification from another thread, whichever instance occurs first. This function does not keep a hold on the monitor or lock the shared object.
sleep() is commonly used to check certain results at a regular interval, such as polling. wait() is often used in multithreaded conversations to achieve synchronization and avoid race conditions.
Does Spring Bean provide thread-safety?
In default mode, Spring beans are not thread-safe because the scope is a singleton. There will be only one instance per context, which means that having a class-level variable that can be updated by any thread will lead to inconsistent data.
However, the Spring bean scope can be altered to request, prototype, or session to achieve thread-safety. This is a design decision based on project requirements. Making this adjustment will impact performance.
Is Java “pass-by-reference” or “pass-by-value?” This can be a trick question for beginners.
Java is pass-by-value. However, the way to pass the value of an object is to pass the reference to it, which is why this is sometimes confusing for beginners.
Is there a static class in Java?
Java does not have a way to make a top-level class static. However, you can simulate a static class with these steps:
Declare your class final. This prevents class extension.
Make the constructor private. This will prevent instantiation by client code.
Make all the class members and functions static.
Note that the compiler will not prevent you from declaring a non-static member if you attempt to call the instance member.
State the features of an interface.
An interface is a template that contains only the signature of methods, which consist of the numbers, types, and orders of parameters. An interface cannot be implemented on its own because it contains the definition of methods but lacks a method body, but it can derive from more than one interface. The features of an interface include:
Implementing multiple inheritances in code
Defining a specific set of methods and their arguments
Declaring variables as public, static, and final
Declaring methods as public and abstract
Implementing all methods of the class
What are the differences between continuous integration, continuous delivery, and continuous deployment?
Continuous integration is when developers merge their changes back to the main branch as often as possible. Adopting this practice helps to avoid issues that occur when people have to wait for release day to merge their changes into the release branch.
Continuous delivery is a step further from continuous integration. It ensures that you can release new changes to your customers in a quick, efficient way. In addition to automated testing, the release process is also automated so the application can be deployed at any time with a click of a button.
Continuous deployment is yet another extension building on the other two practices. There is no human intervention; every change that passes all stages of production is released to customers.
What is a Controller in the Spring MVC framework?
Controllers provide access to the application behavior by interpreting user input and transforming it into a representational model. Spring’s controller implementation is very abstract, which enables a developer to create a variety of different controllers.
What is the Spring IoC Container?
The Spring container uses dependency injection (DI) to manage the components that make up an application. It is responsible for creating objects, wiring them together, configuring them, and managing their complete lifecycle.
There are two types of Spring IoC containers:
Bean Factor Container. Basic support for DI. This container is the simplest and is usually preferred when resources are limited, such as for mobile devices or applet-based applications.
Spring ApplicationContext Container. Enterprise-specific functionality. Examples include the ability to resolve textual messages from a properties file or the ability to publish application events to interested listeners.
What is a JavaBean?
A bean must be a serializable object that has properties with getters and setters that are just methods with certain names. It must also have a public 0-arg constructor so it can be created at will and then be configured by property settings. A class is considered a JavaBean if it follows all of the standards.
What is the difference between fail-fast and fail-safe?
Fail-safe works with the clone of an underlying collection and is therefore not affected by any modifications in the collection. Fail-fast iterators utilize a ConcurrentModificationException; fail-safe iterators do not throw such an exception.
All of the classes in java.util are fail-fast. The collection classes in java.util.concurrent are fail-safe.
What is the structure of Java Heap?
The JVM has a heap of runtime data. Memory for all class instances and arrays is allocated to this heap, which is created at the JVM start-up. Heap memory for objects is reclaimed by the garbage collector, which is an automatic memory management system.
Both living objects, which are accessible by the application and won’t be part of garbage collection, and dead objects, which will never be accessible by the application but haven’t yet been collected by the garbage collector, make up the heap memory space until the dead objects eventually end up in the garbage collector.
What is the JIT?
JIT stands for Just In Time and is the JVM’s mechanism to optimize code at runtime. It can perform code inlining, lock coarsening, lock eliding, escape analysis, and other optimizations.