Practice is the key when it comes to improving your interview skills. On this page, you’ll find 200 core Java questions, covering questions on OOPs, Overloading, and Overriding, Inheritance, Exception Handling, Packages, Interfaces, etc. So, start practicing for your next interview with our carefully selected interview questions. By studying these questions, you will strengthen your knowledge and be able to answer with confidence in your interviews. As these questions have simple answers, you will not have to look anywhere for the answers.
Our core Java interview questions page is a complete guide to interview preparation. It will help you prepare for various jobs including Java developer, backend developer, full-stack developer, and more. So, let’s get started.
- compile-time polymorphism and
- runtime polymorphism.cal
- A vector is synchronized, whereas an ArrayList is non-synchronized.
- When re-sized, an ArrayList grows by half of its size, while a vector doubles the size of itself by default.
- An Iterator is used to traverse a set, list, & map, whereas a ListIterator is only useful for traversing a list.
- When using an Iterator, we can traverse only in the forward direction, but ListIterator enables us to traverse in both the forward and backward directions.
- CountDownLatch is a construct that a thread looks out for while different threads tally down on the latch until it arrives at zero. Whereas, CyclicBarrier is a reusable construct where a gathering of threads stands by together until the entirety of the threads shows up. By then, the barrier is broken and a move can alternatively be made.
- CountDownLatch keeps up a count of tasks. While, CyclicBarrier keeps up a count of threads.
- In CountDownLatch single thread can countdown more than once, this would reduce count by number of times countdown() method is called. In contrast, CyclicBarrier single thread can call awaits only once which would reduce barrier count by one only, even if call awaits() method more than once.
- CountDownLatch is advanceable. While, CyclicBarrier is not advanceable.
- SAX is called a Simple API for XML Parsing. While, DOM is called as Document Object Model.
- SAX is an event-based parser. Whereas, DOM stays in a tree structure.
- SAX Parser is slower than DOM Parser.
- SAX Parser is suitable for making XML files in Java. In contrast, DOM is not good at making XML files in low memory.
- SAX Parser loads small part of the XML file is only loaded in memory. While, DOM Parser loads whole XML documents in memory.