Briefly describe the JDBC Principle + what exceptions are in Java + throws and throw differences + simple explanations for the following polymorphism in Java

Source: Internet
Author: User

JDBC Principle:

Add: Load Driver

Chain: Creating a connection

Pre: Create precompilation

Execute SQL statement (query requires processing result level)

Release: Close link;

Some interfaces are defined in DBC:
1. Drive Management:
DriverManager
2. Connection interface
Connection
DatabaseMetaData
3. Statement Object interface
Statement
PreparedStatement
CallableStatement
4. Result set interface
ResultSet
ResultSetMetaData

JDBC only defines interfaces, which are the responsibility of each database vendor.
Programmers only need to invoke the interface when using, the actual call is the implementation part of the underlying database vendor.

What is an exception in Java:

An abnormal condition that occurs during the operation of the program ; This behavior is called an exception.

The top-level parent class for Throwable is divided into Error and Exception exceptions

Error , which cannot be processed once it occurs ( such as a memory overflow ); and for Exception can usually be processed ;

  

Difference between throws and throw

Throw: Produces an exception object, positioned in the method, followed by an exception object, equivalent to the effect of return

Throws: Indicates that the exception method is thrown out of () {}, followed by multiple exceptions

Simply explain the polymorphism in the following Java:

  

The role of polymorphism: to eliminate the coupling relationship between types. (Coupling relationship refers to the relationship between two things if there is an interaction and interaction, then the relationship is called "coupling relationship")
There are two kinds of polymorphism: 1) Compile-time polymorphism for multiple methods with the same name, if at compile time it is possible to determine which of the methods in the same name is executed, then it is called compile-time polymorphism. 2) Runtime polymorphism If you cannot determine at compile time, you can only determine which of the multiple methods with the same name is run-time polymorphism
Three necessary conditions for polymorphic existence one, to have inheritance; second, to have the override; the parent class refers to the subclass object.

Briefly describe the JDBC Principle + what exceptions are in Java + throws and throw differences + simple explanations for the following polymorphism in Java

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.