Top 10 Interview Questions & Answers for Java Developers

An organization hiring a Java developer is looking for someone who can code the applications flawlessly. For the period after Java training, the following is a very important list of ten Java interview questions. Make sure you tap the benefits of this comprehensive list of questions shared by our Java counterparts to crack your next interview.

1. What is immutable object? Can you write immutable object?
Basically Immutable classes are Java classes whose objects can not be altered once created. Any alteration in Immutable object result in new object. For example: String is immutable in Java. Mostly Immutable are also final in Java, to prevent sub class from overriding methods which can compromise Immutability. You can achieve same functionality by making member as non final but private, and without changing them except in constructor.

2. What is the difference when String is gets created using literal or new() operator?
When we create string with new() its created in heap and not included into string pool while String created using literal are created in String pool itself, which exists in Perm area of heap.

3. Define JAXB & JAXP?
JAXB: – It Stands for Java API for XML Binding. This standard characterizes a system for a script out Java objects as XML and for creating Java objects from XML structures.
JAXP: – Stands for Java API for XML Processing. This gives a typical interface for creating and using DOM, SAX, and XSLT APIs in Java regardless of which vendor’s implementation is actually being used.

4. Which two method you need to implement for key Object in HashMap?
To use any object as Key in HashMap, it must implement equals and hashcode method in Java. Learn how HashMap works in Java for detailed clarification on how equals and hashcode method is used to put and get object from HashMap. 

5. Do you think all property of Immutable Object needs to be final?
Not compulsory as we can easily achieve the same by making member as non-final but private and not changing them except in the constructor. Additionally, avoid providing setter methods for them. In case of mutable object, then prevent leaking any reference for that member.

6. Can you quickly brief about Map, HashMap, HashTable, and TreeMap?
Map :- Map is an interface,
HashMap :- It is a class that implements a Map. It is unsynchronized and supports null values and keys.
Hashtable :- Hashtable is a synchronized version of HashMap
TreeMap :- It is similar to HashMap but uses Tree to implement Map

7. What is difference between Executor.submit() and Executer.execute() method ?
There is a difference when looking at exception handling. If your tasks throws up an exception and if it was applied with execute, this exception will go to the uncaught exception handler (when you don't have provided one explicitly, the default one will just print the stack trace to System.err). In case you submitted the task with submit any thrown exception, checked exception or not, is then part of the task's return status. For a task that was submitted with submit and that ends or terminates with an exception, the Future. Get will re-throw this exception, wrapped in an ExecutionException.

8. Does not overriding hashcode() method has any performance implication ?
A poor hashcode function will result in frequent collision in HashMap which eventually increase time for adding an object into Hash Map.

9. Could you differentiate an Interface and an Abstract class?
An abstract class may have instance methods, which can implement a default behavior. On the other hand, an interface can’t implement any default behavior. It can declare different instance and constants methods. While an interface has all the public members, an abstract class contains only class members like private, protected and so on.

10. What is the difference between HashSet and TreeSet? 
The HashSet is executed using a hash table and along these, its elements are not ordered. The add, contains, and remove methods of a HashSet have constant time complexity O(1). Then again, a TreeSet is executed using a tree structure. The elements in a TreeSet are sorted, and along these, the add, contains, and remove methods have time complexity of O(logn).

Knowing answers to the above questions will certainly help you crack the Java developer certification course first and then the subsequent job. You can learn any kind of Java course at Koenig Solutions.

Java certification courses must be learnt only from a reputed institute like Koenig Solutions. Here you can be assured of certified trainers to guide you on every aspect of this language. The Java certification is instrumental for a successful career in any IT field.

So what are you waiting for? Choose your Java certification course today.

Views: 77


You need to be a member of Oracle Community to add comments!

Join Oracle Community

Oracle Community On

I'm not a fan of advertising, and so I will not be including any advertisements on However, managing this community does not come without cost! If you are willing to donate to help pay for the monthly community fees and domain services I accept Bitcoin and PayPal donations.

Donate Bitcoins



Blog Posts

Suntec’s Data Mining Services Help You Get Efficient Data

It is a well- established fact that the availability of accurate and updated data is the base of undertaking successful business operations. Data is required at all point of business operations ranging from buying of goods and services from suppliers to marketing your final product. Often, business organizations fail to utilize their data to its full potential.

At SunTec, our…


Posted by Alvaro Dee on May 26, 2017 at 3:46am

Convert Prospects into Repeat Customers with Amazon Data Entry Services

eCommerce store owners get a better exposure for their products by selling on a platform like Amazon. If you are thinking about selling on Amazon or you are already a seller who needs help in managing product listings on this popular online marketplace, stop worrying. Professionals with sound technical knowledge of Amazon product listings, categorization, content, etc. are there to make things easier for you.

You can outsource …


Posted by Alvaro Dee on April 12, 2017 at 10:05pm

Increase Sales with Unique and Compelling Product Descriptions

Are you thinking about opening an online store? Or, do you already have one? Whether you have a small online business or a big store, the manner in which you list your products leads to a dramatic impact on your sales.

Don’t just sell a product, you need to sell an experience.
You yourself get excited about the features and specifications of your products. But the problem is that your…


Posted by Alvaro Dee on April 10, 2017 at 11:18pm

Business Research Helps You Understand Critical Traits of Your Business

Business organization needs strong customer and actionable industry insights to develop better understanding of its market and other important aspects. It can meet business objectives and make tactical, strategic and operational decisions with the help of business research services. The growth of a company largely depends on effective business research. You can conduct a successful market research with…


Posted by Alvaro Dee on April 3, 2017 at 3:23am

© 2017   Created by Steve Karam.   Powered by

Badges  |  Report an Issue  |  Terms of Service