التخطي إلى المحتوى الرئيسي

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?

 

تعليقات

  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) {
    super(s);
    }
    }
    User define unchecked Exception:
    class UserDefinedException extends Exception {
    UserDefinedException(String s) {
    super(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();

    fruitList.add("Mango");
    fruitList.add("Banana");
    fruitList.add("Apple");
    fruitList.add("Strawberry");
    fruitList.add("Pineapple");


    furitList = Collections.synchronizedList(fruitList);


    synchronized (fruitList) {
    Iterator itr = fruitList.iterator();
    while (itr.hasNext()) {
    System.out.println(itr.next());
    }
    }
    }
    }
    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 Answer of Questions and ASK to Doubt

المشاركات الشائعة من هذه المدونة

Uncontrolled form input in React-JS

  Uncontrolled form input in React-JS? If we want to take input from users without any separate event handling then we can uncontrolled the data binding technique. The uncontrolled input is similar to the traditional HTML form inputs. The DOM itself handles the form data. Here, the HTML elements maintain their own state that will be updated when the input value changes. To write an uncontrolled component, you need to use a ref to get form values from the DOM. In other words, there is no need to write an event handler for every state update. You can use a ref to access the input field value of the form from the DOM. Example of Uncontrolled Form Input:- import React from "react" ; export class Info extends React . Component {     constructor ( props )     {         super ( props );         this . fun = this . fun . bind ( this ); //event method binding         this . input = React . createRef ();...

JSP Page design using Internal CSS

  JSP is used to design the user interface of an application, CSS is used to provide set of properties. Jsp provide proper page template to create user interface of dynamic web application. We can write CSS using three different ways 1)  inline CSS:-   we will write CSS tag under HTML elements <div style="width:200px; height:100px; background-color:green;"></div> 2)  Internal CSS:-  we will write CSS under <style> block. <style type="text/css"> #abc { width:200px;  height:100px;  background-color:green; } </style> <div id="abc"></div> 3) External CSS:-  we will write CSS to create a separate file and link it into HTML Web pages. create a separate file and named it style.css #abc { width:200px;  height:100px;  background-color:green; } go into Jsp page and link style.css <link href="style.css"  type="text/css" rel="stylesheet"   /> <div id="abc"> </div> Exam...

JDBC using JSP and Servlet

JDBC means Java Database Connectivity ,It is intermediates from Application to database. JDBC has different type of divers and provides to communicate from database server. JDBC contain four different type of approach to communicate with Database Type 1:- JDBC-ODBC Driver Type2:- JDBC Vendor specific Type3 :- JDBC Network Specific Type4:- JDBC Client-Server based Driver  or JAVA thin driver:- Mostly we prefer Type 4 type of Driver to communicate with database server. Step for JDBC:- 1  Create Database using MYSQL ,ORACLE ,MS-SQL or any other database 2   Create Table using database server 3   Create Form according to database table 4  Submit Form and get form data into servlet 5  write JDBC Code:-     5.1)   import package    import java.sql.*     5.2)  Add JDBC Driver according to database ide tools     5.3)  call driver in program         ...