See Java Fundamentals: Collections by Richard Warburton to learn more.ġ6) How does ConcurrentHashMap achieve scalability? ( answer) It's also legacy class like Hashtable.ġ5) Difference between Hashtable and ConcurrentHashMap in Java? ( answer) Hint: Many, but most important is that ArrayList is non-synchronized and fast while Vector is synchronized and slow. Set is unordered and doesn't allow duplicate elements.ġ4) Difference between ArrayList and Vector in Java ( answer) Hint: List is ordered and allows duplicate. It's also legacy and slow as compared to HashMap.ġ3) Difference between Listand Set in Java? ( answer) Hint: several but most important is Hashtable, which is synchronized, while HashMap is not. Hint: No, because it’s not visible in the subclass, a primary requirement for overriding a method in Java.ġ2) Difference between Hashtable and HashMap in Java? ( answer) Hint: Externalizable gives you more control over the Serialization process.ġ1) Can we override the private method in Java? ( answer) Hint: totally different, one used in the context of serialization while the other is used in concurrency.ġ0) Difference between Serializable and Externalizable in Java? ( answer) See The Complete Java MasterClass to learn about transient variables in Java.ĩ) Difference between the transient and volatile variable in Java? ( answer) In other words, you can use it for a variable whose value you don’t want to save. Hint: when you want to make a variable non-serializable in a class, which implements the Serializable interface. Hint: when you need to instruct the JVM that a variable can be modified by multiple threads and give hint to JVM that does not cache its value.Ĩ) When to use a transient variable in Java? ( answer) Hint: many ways, like using Enum or by using double-checked locking pattern or using a nested static class.ħ) When to use the volatile variable in Java? ( answer) Hint: two-time check whether instances is initialized or not, first without locking and second with locking.Ħ) How do you create thread-safe Singleton in Java? ( answer) See Java Fundamentals: Collections by Richard Warburton to learn more about ArrayList, HashSet and other important Collections in Java.ĥ) What is double checked locking in Singleton? ( answer) ordering, duplicates, random search, etc. Hint: all differences between List and Set are applicable here, e.g. Hint: you can use bitwise operator, like bitwise AND, remember, even the number has zero at the end in binary format and an odd number has 1 in the end.Ĥ) Difference between ArrayList and HashSet in Java? ( answer) You can write your own.ģ) Write a Java program to check if a number is Even or Odd? ( answer) Hint: part of JVM that loads bytecodes for classes. This list focuses on beginners and less experienced devs, like someone with 2 to 3 years of experience in Java.ġ) How does Java achieve platform independence? ( answer)Ģ) What is ClassLoader in Java? ( answer) So, without wasting any more of your time, here is my list of some of the frequently asked Core Java Interview Questions for beginner programmers. 50+ Java Interview Questions for 2 to 3 years Experienced Programmers So what are we waiting for? Here is the list of some of the most frequently asked Java questions in interviews for both beginner and experienced Java developers. I have also shared some useful resources for further learning and improvement like The Complete Java MasterClass to brush up and fill gaps in your Java skills. The questions are also very useful to review important topics like multithreading and collections. You might have seen them already in your phone or face-to-face round of interviews. The questions are also picked up from various interviews and they are, by no means, very difficult. This article contains more than 50 Java Interview questions covering all important topics like Core Java fundamentals, Java Collection Framework, Java Multithreading and Concurrency, Java IO, JDBC, JVM Internals, Coding Problems, Object-Oriented programming, etc. Many of my readers have requested that I bring them together so that they can have them in the same spot. Hello, everybody! Over the past few years, I have been sharing a lot of Java Interview questions and discussion individually. By javinpaul Review these 50 questions to crack your Java programming interview A list of frequently asked Java questions from programming job interviews.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |