95 Advanced Java Interview Questions
95 Advanced Java Interview Questions
AdvJava
1)Which are the components of java programming language?
➔i)Variable
ii)Methods
iii)Constructors
iv)Blocks
v)Classes
vi)Interface
vii)Abstract Class
➔i)Class
ii)Object
iii)Abstraction
iv)Polymorphism
v)Encapsulation
vi)Inheritance
5)What is JDBC?
➔JDBC stands for “Java Database Connectivity” and which is used to interact with database
Product.
Created by:-Lalit Ingale
6)What is Servlet?
➔Servlet means “Server Program” and which is used to accept the request from user through web
Browser and provide the response.
7)What is JSP?
➔JSP stands for “Java Server Page” and which is response from server application(Web Application)
8)Define Storage?
➔The memory location where the data is available for accessing is known as Storage.
iv)Array objects
v)Collection<E> objects
vi)Map<K,V> objects
Created by:-Lalit Ingale
vii)Enum<E> objects
13)Define Stream?
➔The Continuous flow of data(0’s and 1’s) is known as Stream.
v)File system corruption(File system can be corrupted due to the fragmentation or matadata)
vi)Security problem(File system will have security problems)
15)Define ‘driver’?
➔The small software program which establishes connection between two end-point is known as
‘driver’.
iv)Thin driver
iii)prepareCall()
iv)getAutoCommit()
v)setAutoCommit()
Created by:-Lalit Ingale
vi)setSavePoint()
vii)releaseSavePoint()
ix)commit()
x)close()
19)Define getRef()?
➔This getRef() method internally generate implementation object for interface Test , because
getRef() method internally holding ‘Anonymous Local InnerClass as implementation of class.
20)Define getConnection()?
➔getConnection() method internally generate implementation object for Connection Interface ,
Because getConnection() method internally holding ‘Anonymous Local InnerClass’ as implementa-
tion class of ‘Connection’.
22)Define Statement?
➔-’Statement’ is an interface from java.sql package and Which is used to execute normal queries
(Create,Insert,Update,Select,Delete) without IN-Parameter.
-Syntax:
Statement stm = con.createStatement();
-The following are two important methods of ‘Statement’:
i)executeQuery() – Used to execute Select-queries.
ii)executeUpdate() – Used to execute NonSelect-queries.
24)Define PreparedStatement?
➔-’PreparedStatement’ is an interface from java.sql package and which is used to execute normal
queries with IN-Parameter.
-Syntax:
PreparedStatement ps = con.preparedStatement(“query-structure”);
-The following are two important methods of PreparedStatement interface.
i)executeQuery() – used for Select queries.
ii)executeUpdate() – used for Non-Select queries.
Result rs = ps.executeQuery();
-Syntax:-
PreparedStatement ps = con.preparedStatement(“Select – query – structure”,type,mode);
ResultSet rs = ps.executeQuery();
Created by:-Lalit Ingale
27)Define ‘type’?
➔”type” specifies the direction of cursor on ResultSet Objects.
-The following field from “ResultSet’ specify the “type”:
28)Define ‘mode’?
29)Which are the important methods used to control the cursor on ResultSet Object?
➔i)afterLast()
ii)beforeFirst()
iii)previous()
iv)next()
v)first()
vi)last()
vii)absolute(int)
viii)relative(int)
30)Define Stream?
➔The continuous flow of data is known as Stream.
31)Types of Stream.
➔-Java language supports two types of streams
i)Byte Stream
-The continuous flow of data in the form of 8-bits is known as Byte Stream or Binary Stream.
-Through Byte stream we can send all types of multimedia data, which means we can send Text,
Created by:-Lalit Ingale
Stream data.
b)CLOB:-
CLOB stands for “Character Large Object” and which is used to store Character Stream data.
33)Define ‘FileInputStream’?
➔’FileInputStream’ class is from java.io package and which is instantiated to link(open) the file to
35)Define ‘FileOutputStream’?
➔’FileOutputStream’ class is from java.io package and which is instantiated to create a new file
with 0-KB and which is linked to write byte – stream – data.
-Syntax:-
FileOutputStream fos = new FileOutputStream(“fPath & fName”);
Created by:-Lalit Ingale
-Syntax:-
Blob b = rs.getBlob(3);
Array.
-Syntax:-
Byte by[] = b.getBytes (1, (int) b.length());
38)What is CollableStatement?
➔’CollableStatement’ is an interface from java.sql package and which is used to execute Procedure
and Functions from Database product.
-We use prepareCall() – method from ‘Connecting interface’ to create implementation object for
CollableStatement interface.
-Syntax:-
CollableStatement cs = con.prepareCall (“{call ProcName/FuncName}”);
39)What is Function?
➔The part of program which is executed out of main program in C-language is known as Function.
41)What is Method?
➔The function which is declared only inside the class in java is known as Method.
Created by:-Lalit Ingale
-Structure in Procedure.
➔create or replace Procedure-name
(para_list)
Begin
query – 1
query – 2
---------
End;
/
43)Types of Procedure.
➔a)IN – Parameter Procedure
The Procedure which take the data from Java program and load on to DB – Product , are
Known as IN-Parameter Procedure.
b)OUT – Parameter Procedure
The Procedure which take the data from DB - Product and send to Java Program , are known as
OUT – Parameter Procedure.
c)IN – OUT Parameter Procedure
The procedure which perform both operation, which means IN and OUT are known as IN-OUT
Parameter Procedure.
45)Structure of Function.
➔-create or replace Function Function-name
Created by:-Lalit Ingale
end;
/
46)Define Transaction?
➔Set of statement executed on a single resource or multiple resources using ACID properties is
known as Transaction
-A:- Atomicity
The process of executing all statement in transaction at-a-time or not-at-all, is known as
Atomicity.
-C:- Consistency
The process in which the selected state – of – resources remain same until the transaction is
Completed , is known as Consistency.
-I:- Isolation
The process of executing multiple users independently Is known as Isolation.
-D:- Durability
The process of recording the state of transaction and making it available for user is known as
Durability.
Management.
-We are used the following method in Transaction Management.
i)getAutoCommit()
ii)setAutoCommit()
iii)setSavepoint()
iv)releaseSavepoint()
v)Commit()
vii)rollback()
Created by:-Lalit Ingale
49)Define MetaData?
➔The data which is holding information about another data is known as MetaData.
-The following components in JDBC generate MetaData object.
i)Database MetaData
ii)Parameter MataData
iii)ResultSet MataData
iv)CollableStatement Object
v)ResultSet Object
vi)DatabaseMetaData Object
Created by:-Lalit Ingale
vii)ParameterMetaData Object
viii)ResultSetMetaData Object
ix)RawSet Object
x)RawsetMetaData Object
53)Define ‘AutoCloseable’?
➔’AutoCloseable’ is an interface from java.lang.package and which supports auto-closing
Operations in try-with-resource-statement.
-The component which are used in try-with-resource-statement must be implemented or
Extended from “java.lang.AutoCloseable” interface.
-JDBC Components like Connection,Statement,PreparedStatement,CollableStatement and
ResultSet will supports auto-closing operations, because they are extended from ‘AutoCloseable-
Interface.
54)Define ‘RowSet’?
➔’RowSet’ is an interface from javax.sql package and which is also used to hold the result
generated from select queries.
56)Java Platforms.
➔-Java Platforms are categorized into the following.
i)Java SE
-Java SE stands for “Java Standard Edition’ and, which provide API and environment to develop
Non-Server-based-Application(Core Java+JDBC)
ii)Java EE
-Java EE stands for “Java Enterprise Edition” and, which provide API and environment to develop
-The Server-based-Application which are constructed using JDBC, Servlet, and JSP are known as
Web Application.
ii)Enterprise Application
-The Server-based-Application which are executed in distributed environment and depending on
the features like “Security”, “Load Balancing” and “Clustering” are known as Enterprise
Application.
62)Define Servlet?
➔The Platforms independent Java-Program which is executed in Server environment and interacts
with user through Web-Browser, is known as Servlet Program or Server Program.
63)Define Client?
➔Client represents WebBrowser, from where the request is generated for server. The request
which is raised from Web Browser is known as HTTP request and which is categorized into two
types.
i)POST request:-
-The request which is raised to send the data to server is known as POST request.
ii)GET request:-
-The request which is raised to get the data from the server is known as GET request.
64)Define Server?
➔Server means Service Provider, which means accepting the request and providing the response.
-In realtime Servers are categorized into two types.
i)Web Servers
A Web Server is a software that stores websites and sends web pages to users when they
request them through a browser.
Created by:-Lalit Ingale
ii)Application Servers
An Application Server is a software that runs business logic (like calculations, data processing)
and creates dynamic web pages for users.
➔i)init()
-Init() method is used to perform initialization process which means making the program ready
for execution.
ii)service()
-service() method is used to handle the request, which means accepting the request and
67)Define ServletContext?
➔ ServletContext is an object provided by the web server that gives information about the web
application and lets all servlets share data with each other.
68)Define ServletConfig?
➔ ServletConfig is an object that gives information to a specific servlet from the web server.
69)Define ServletRequest?
➔ServletRequest is used to handle the details of the incoming request from the client to the
Created by:-Lalit Ingale
70)Define ServletResponse?
➔ServletResponse is used to build and send a response from the server back to the client in a Java-
PrintWriter pw = rs.getWriter();
➔RequestDispatcher is an interface in Java used in Servlet programming that allows one servlet to
forward a request to another resource (like another servlet, JSP, or HTML file) or to include
content from another resource in the response.
➔ JSP (JavaServer Pages) is a technology used to create dynamic web pages in Java. It allows you to
embed Java code directly into HTML pages, making it easier to build interactive and dynamic
websites.
Created by:-Lalit Ingale
iii)Action Tags
ii)Expression Tag:-
-Expression tag is used to assign the value to variable or send the data to Web Browser directly.
-Syntax:-
<%=
--------Variables,Expression----------
%>
iii)Declarative Tag:-
-Declarative tag is used to declare Variable and methods in JSP Programs.
-Syntax:-
<%!
------------Variables,Methods-----------
%>
i)@page:-
-‘@page’ tag will provide the information about current running JSP page.
-Syntax:-
Created by:-Lalit Ingale
-iii)<jsp : getProperty>
-iv)<jsp : forward>
-v)<jsp : include>
-vi)<jsp : param>
81)Define ‘request’?
➔The query which is generated by user through Web Browser is known as ‘request’.
-request is categorized into two types.
i)POST request
ii)GET request
82)Define Session?
➔The time-interval between User-Login to User-Logout is known as ‘Session’.
Created by:-Lalit Ingale
a)public abstract void setAttribute()--The setAttribute() method is used to store data with a
specific name, making it easy to access that data later in the same session, request, or
application.
b)public abstract java.lang.Object getAttribute()-- In HttpSession, getAttribute() is used to get
data (an object) that was saved in the user's session earlier.
-The process is used to send some data from one servlet-program to another servlet-program in
Session – Tracking process.
-Syntax:-
Servlet-url-pattern?para1 = value¶2 = value¶3 = value&………….
86)What is Cookie?
➔ A cookie is a small piece of data that a website stores on your browser (your computer or
phone). It helps the website remember you when you visit again!
87)Types of Cookies.
➔i)Persistent Cookie:-
The cookies which are stored and available in Web-Browser until user logout , are known as
Persistent Cookies.
ii)Non-Persistent Cookie:-
The cookies which are destroyed automatically when the Web-browser is closed , are known as
Non-Persistent Cookies.
equal to the number of cookies , in this process it also reconstruct. (deserialization) the cookie –
object and add to the array.
-Syntax:-
Cookie c[] = req.getCookie();
-These Web Application Architecture Models are categorized into two types.
i)Model – 1 Architecture:- Model-1 is the first architecture to develop Web Application , and
Which is JSP is the controller of total application.
Created by:-Lalit Ingale
95)What is MVC?
➔-M:-Model Layer represents Bean – objects , where the data is available , Model layer also