Java
What modifiers are allowed for methods in an Interface?
Dec 2nd
Only public and abstract modifiers are allowed for methods in interfaces.
What is an Interface?
Dec 2nd
An interface is a description of a set of methods that conforming implementing classes must have. Note:
- You can’t mark an interface as final.
- Interface variables must be static.
- An Interface cannot extend anything but another interfaces.
What is super?
Dec 2nd
super is a keyword which is used to access the method or member variables from the superclass. If a method hides one of the member variables in its superclass, the method can refer to the hidden variable through the use of the super keyword. In the same way, if a method overrides one of the methods in its superclass, the method can invoke the overridden method through the use of the super keyword.
Note:
- You can only go back one level.
- In the constructor, if you use super(), it must be the very first code, and you cannot access any
this.xxxvariables or More >
Which type of JDBC driver is the fastest one?
Dec 2nd
JDBC Net pure Java driver(Type IV) is the fastest driver because it converts the JDBC calls into vendor specific protocol calls and it directly interacts with the database.
How the JDBC application works?
Dec 2nd
A JDBC application can be logically divided into two layers:
1. Driver layer
2. Application layer
- Driver layer consists of DriverManager class and the available JDBC drivers.
- The application begins with requesting the DriverManager for the connection.
- An appropriate driver is choosen and is used for establishing the connection. This connection is given to the application which falls under the application layer.
- The application uses this connection to create Statement kind of objects, through which SQL commands are sent to backend and obtain the results.
Exaplain the JDBC Architecture.
Dec 2nd
The JDBC Architecture consists of two layers:
- The JDBC API, which provides the application-to-JDBC Manager connection.
- The JDBC Driver API, which supports the JDBC Manager-to-Driver Connection.
The JDBC API uses a driver manager and database-specific drivers to provide transparent connectivity to heterogeneous databases. The JDBC driver manager ensures that the correct driver is used to access each data source. The driver manager is capable of supporting multiple concurrent drivers connected to multiple heterogeneous databases. The location of the driver manager with to the JDBC drivers and the Java application is shown in Figure .
How do I load a database driver with JDBC 4.0 / Java 6?
Dec 1st
Provided the JAR file containing the driver is properly configured, just place the JAR file in the classpath. Java developers NO longer need to explicitly load JDBC drivers using code like Class.forName() to register a JDBC driver.The DriverManager class takes care of this by automatically locating a suitable driver when the DriverManager.getConnection() method is called. This feature is backward-compatible, so no changes are needed to the existing JDBC code.
What are the advantages of DataSource?
Dec 1st
The few advantages of data source are :
- An application does not need to hardcode driver information, as it does with the
DriverManager. - The
DataSourceimplementations can easily change the properties of data sources. For example: There is no need to modify the application code when making changes to the database details.
The DataSource facility allows developers to implement a DataSource class to take advantage of features like connection pooling and distributed transactions
What is the jspDestroy() method?
Dec 1st
The jspDestroy() method of the javax.servlet.jsp.JspPage interface is invoked by the container when a JSP page is about to be destroyed. This method is similar to the destroy() method of servlets. It can be overridden by a page author to perform any cleanup operation such as closing a database connection.