Core Java Interview Question for Experienced Candidate

Core Java Interview Question for an experienced candidate

Top 20 Java Interview Question, Check Your Java Skills.

1)  What is annotation in Java, How we can create custom annotation?
2)  What is Reflection API in Java?
3)  How we can create Checked User Define Exception and  Unchecked User Define Exception?
4)  What is Inner class, Local Inner Class, Static Inner Class, Anonymous Class
5)   What is a Generic Class in Java  How we can define Custom Generic Class
6)  How we can Synchronize Array List?
7)   Which is the best Collection class to add and edit elements concurrently?
8)   What is the Marker interface, the difference between annotation and marker Interface?
9)    What will be the output when we call run() manually in Thread?
10)   What is the Design pattern in Java define Creational, Behavioral, and Structural Design Pattern?
11)    Difference between Comparable and Comparator?
12)  What is the final class in java, provide the name of predefined Final Class in java?
13)   What is Singleton Class in Java?
14)    A map is the part of the Collection Framework or not?
15)   What is dependency Injection in Java?
16)   What new features added in Interface in Java?
17)     What is the Difference between System.out and Console?Write() in Java?
18)    What is Lambda expression and foreach() in Java?
19)    What is the difference between volatile and Transient modifiers in java?
20)   If we did not know the datatype of the column in ResultSet then which method will work to show data?
21) What is the difference between “==” and “equals(…)” in comparing Java String objects?
22) In Java, what purpose do the key words final, finally, and finalize fulfill?
23) When you have automatic memory management in Java via GC, why do you still get memory leaks in Java?
24)  What are the differences between Heap and Stack Memory in Java?
25) What is Java String Pool?
26) What is a classloader in Java?
27) What is the difference between abstract classes and interfaces?
28) Can you override a private or static method in Java?
29) What is an association, aggregation, composition in JAVA?
30) What is object cloning in Java?
31) What is Request Dispatcher?
32) What are the different methods of session management in servlets?


Post a Comment


POST Answer of Questions and ASK to Doubt

  1. Q1). What is annotation in java.How we can create custom annotataion?
    Ans). Annotation is a tag that represent the metadata. Attached with class,interface,methods or fields to indicate some additional information which can be used by java compiler and jvm.
    Q2). What is Reflection API in java?
    Ans). Reflection is an API which is used to examine or modify the behavior of methods, classes, interfaces at runtime.
    • The required classes for reflection are provided under java.lang.reflect package.
    • Reflection gives us information about the class to which an object belongs and also the methods of that class which can be executed by using the object.
    • Through reflection we can invoke methods at runtime irrespective of the access specifier used with them.

    Q3). How to create user define checked or unchecked Exception?
    Ans). User define unchecked Exception:
    class UserDefinedException extends RuntimeException {
    UserDefinedException(String s) {
    User define unchecked Exception:
    class UserDefinedException extends Exception {
    UserDefinedException(String s) {

    Q3 How we can synchronize Array List?
    Ans). We can use Collections class to synchronize array list

    public class SyncronizeArrayList {
    public static void main(String args[]) {

    List fruitList = new ArrayList();


    furitList = Collections.synchronizedList(fruitList);

    synchronized (fruitList) {
    Iterator itr = fruitList.iterator();
    while (itr.hasNext()) {
    Q4) which is the best collection class is to add and edit elements concurrently?
    Ans). LinkedList is the best class to edit and add the elements because it uses doubly linked list. In Doubly linked list we can add or delete elements at every end.
    Q5) what will be the output when we call run() manuaaly in thread?
    Ans) if we call run() directly then it does not work like thread it can normal work.

Post a Comment