background preloader

Java Interview Topics

Facebook Twitter

Top 30 Programming questions asked in Interview - Java C C++ Answers. Programming questions are integral part of any Java or C++ programmer or software analyst interview.

Top 30 Programming questions asked in Interview - Java C C++ Answers

No matter on which language you have expertise it’s expected that you are familiar with fundamental of programming and can solve problems without taking help of API. Programming questions like How to reverse String using recursion or How to find if Array contains duplicates are some popular examples of programming question in Java. Programming questions present lot of challenges Especially to Java developers as compared to C++ programmer and I think, One reason for this is powerful Java API; Which has method for almost every need and you rarely need to write by your own or there are lots of third party library from Apache, Spring, Google and other open source.

Top 25 Java Collection Framework Interview Questions Answers for Freshers and Experienced Programmers. Interview questions from Collection package or framework is most common in any Core Java Interview yet a tricky one.

Top 25 Java Collection Framework Interview Questions Answers for Freshers and Experienced Programmers

Together Collection and multithreading makes any Java interview tough to crack and having a good understanding of Collection and threads will help you to excel in Java interview. I thought about writing interview questions on collection when I wrote 10 multi-threading Interview questions and Top 20 Core Java Interview questions answers but somehow it got delayed.

In this article we will see mix of some beginners and advanced Java Collection interviews and there answers which has been asked in various Core Java interviews. These Collection interview questions have been collected from various friends and colleagues and Answers of these interview questions can also be found by Google. Now let's start with interview questions on collections. Difference between ArrayList and Vector in Java. Why wait, notify and notifyAll is defined in Object Class and not on Thread class in Java. Why wait, notify and notifyAll is declared in Object Class instead of Thread is famous core java interview question which is asked during all levels of Java interview ranging from 2 years, 4years to quite senior level position on java development.

Why wait, notify and notifyAll is defined in Object Class and not on Thread class in Java

Beauty of this question is that it reflect what does interviewee knows about wait notify mechanism, how does it sees whole wait and notify feature and whether his understanding is not shallow on this topic. Like Why Multiple inheritance is not supported in Java or why String is final in java there could be multiple answers of why wait and notify is defined in Object class and every one could justify there reason. In my all interview experience I found that wait and notify still remains most confusing for most of Java programmer specially up-to 2 to 3 years and if they asked to write code using wait and notify they often struggle.

Here are some thoughts on why they should not be in Thread class which make sense to me : Difference between ConcurrentHashMap and Collections.synchronizedMap and Hashtable in Java. Collections classes are heart of java API though I feel using them judiciously is an art.

Difference between ConcurrentHashMap and Collections.synchronizedMap and Hashtable in Java

Its my personal experience where I have improved performance by using ArrayList where legacy codes are unnecessarily used Vector etc. JDK 1.5 introduces some good concurrent collections which is highly efficient for high volume, low latency system electronic trading systems In general those are backbone for Concurrent fast access of stored data. Difference between HashMap and HashTable? Can we make hashmap synchronized? 20 Design pattern and Software design interview questions for Programmers. Design patterns and software design questions are essential part of any programming interview, no matter whether you are going for Java interview or C# interview.

20 Design pattern and Software design interview questions for Programmers

In face programming and design skill complement each other quite well, people who are good programmer are often a good designer as well as they know how to break a problem in to piece of code or software design but these skill just doesn’t come. You need to keep designing, programming both small scale and large scale systems and keep learning from mistakes.Learning about Object oriented design principles is a good starting point. Anyway this article is about some design questions which has been repeatedly asked in various interviews. I have divided them on two category for beginners and intermediate for sake of clarity and difficulty level. Design pattern interview questions for Senior and experienced level These are questions which not only relates to design patterns but also related to software design. 1. 1. 2. 3. 4.

Top 10 Spring Interview Questions Answers J2EE. Spring framework interview questions is in rise on J2EE and core Java interviews, As Spring is the best framework available for Java application development and now Spring IOC container and Spring MVC framework are used as de-facto framework for all new Java development.

Top 10 Spring Interview Questions Answers J2EE

With this popularity interview questions from spring framework is top on any list of core Java Interview questions. I thought to put together some spring interview questions and answers which has appeared on many Java and J2EE interviews and useful for practicing before appearing on any Java Job interview. This list of Spring interview questions and answers contains questions from Spring fundamentals e.g. Spring IOC and dependency Injection, Spring MVC framework, Spring Security, Spring AOP etc, because of length of this post I haven't included Spring interview questions from Spring JDBC and JMS which is also a popular topic in core Java and J2EE interviews. Inversion of Control and Dependency Injection design pattern with real world Example - Spring tutorial. Inversion of Control and Dependency Injection is a core design pattern of Spring framework.

Inversion of Control and Dependency Injection design pattern with real world Example - Spring tutorial

IOC and DI design pattern is also a popular design pattern interview question in Java. As name suggest Inversion of control pattern Inverts responsibility of managing life cycle of object e.g. creating object, setting there dependency etc from application to framework, which makes writing Java application even more easy. Programmer often confused between IOC and DI, well both words used interchangeably in Java world but Inversion of Control is more general concept and Dependency Injection is a concrete design pattern. Spring framework provides two implementation of IOC container in form of Application Context and BeanFactorywhich manages life-cycle of bean used by Java application.

As you may know necessity is mother of invention, it benefit to first understand problem solved by IOC and Dependency Injection design pattern. 10 Object Oriented Design Principles Java Programmer should know. 10 Examples of Enum in Java. What is Enum in Java Enum in Java is a keyword, a feature which is used to represent fixed number of well known values in Java, For example Number of days in Week, Number of planets in Solar system etc.

10 Examples of Enum in Java

Enumeration (Enum) in Java was introduced in JDK 1.5 and it is one of my favorite features of J2SE 5 among Autoboxing and unboxing , Generics, varargs and static import. One of the common use of Enum which emerged in recent years is Using Enum to write Singleton in Java, which is by far easiest way to implement Singleton and handles several issues related to thread-safety and Serialization automatically. By the way, Java Enum as type is more suitable to represent well known fixed set of things and state, for example representing state of Order as NEW, PARTIAL FILL, FILL or CLOSED.

Enumeration(Enum) was not originally available in Java though it was available in other language like C and C++ but eventually Java realized and introduced Enum on JDK 5 (Tiger) by keyword Enum. Case PENNY: How to use Comparator and Comparable in Java? With example. 2 solution of java.lang.OutOfMemoryError in Java. Every one in java development face java.lang.OutOfMemoryError now and then, OutOfMemoryError in Java is one problem which is more due to system's limitation (memory) rather than due to programming mistakes in most cases though in certain cases you could have memory leak which causing OutOfMemoryError.

2 solution of java.lang.OutOfMemoryError in Java

I have found that even though java.lang.OutOfMemoryError is quite common basic knowledge of its cause and solution is largely unknown among junior developers. Top 20 Core Java Interview Questions and Answers asked on Investment Banks. Core Java Interview Question Answer This is a new series of sharing core Java interview question and answer on Finance domain and mostly on big Investment bank.Many of these Java interview questions are asked on JP Morgan, Morgan Stanley, Barclays or Goldman Sachs.

Top 20 Core Java Interview Questions and Answers asked on Investment Banks

Banks mostly asked core Java interview questions from multi-threading, collection, serialization, coding and OOPS design principles. Anybody who is preparing for any Java developer Interview on any Investment bank can be benefited from these set of core Java Interview questions and answers. I have collected these Java questions from my friends and I thought to share with you all. I hope this will be helpful for both of us. String vs StringBuffer vs StringBuilder in Java. Difference between String, Stringbuffer and StringBuilder String is one of the most important classes in Java and anyone who starts with Java programming uses String to print something on console by using famous System.out.println() statements. How SubString method works in Java - Memory Leak Fixed in JDK 1.7.

Substring method from String class is one of most used method in Java, and it's also part of an interesting String interview question e.g. How substring works in Java or sometime asked as how does substring creates memory leak in Java. In order to answer these questions, you knowledge of implementation details is required. Recently one of my friend was drilled on substring method in Java during a Java interview, he was using substring() method from long time, and of course all of us has used this, but what surprises him was interviewer's obsession on Java substring, and deep dive till the implementation level. Why String is immutable or final in Java. How HashMap works in Java. How HashMap works in Java How HashMap works in Java or sometime how get method work in HashMap is common questions on Java interviews now days.

Almost everybody who worked in Java knows about HashMap, where to use HashMap or difference between Hashtable and HashMap then why this interview question becomes so special? Because of the depth it offers. It has become very popular java interview question in almost any senior or mid-senior level Java interviews. Investment banks mostly prefer to ask this question and some time even ask to implement your own HashMap based upon your coding aptitude.

Questions start with simple statement "Have you used HashMap before" or "What is HashMap? Almost everybody answers this with yes and then interviewee keep talking about common facts about HashMap like HashMap accept null while Hashtable doesn't, HashMap is not synchronized, HashMap is fast and so on along with basics like its stores key and value pairs etc. Overriding equals() and hashCode() method in Java and Hibernate - Example, Tips and Best Practices. Override equals and hashCode in Java Equals and hashCode in Java are two fundamental method which is declared in Object class and part or core Java library. equals() method is used to compare Objects for equality while hashCode is used to generate an integer code corresponding to that object. equals and hashCode has used extensively in Java core library like they are used while inserting and retrieving Object in HashMap, see how HashMap works in Java for full story, equals method is also used to avoid duplicates on HashSet and other Set implementation and every other place where you need to compare Objects.

Default implementation of equals() class provided by java.lang.Object compares memory location and only return true if two reference variable are pointing to same memory location i.e. essentially they are same object. 1) Reflexive : Object must be equal to itself. 2) Symmetric : if a.equals(b) is true then b.equals(a) must be true.