Which packages contain the JDBC classes?

  1. java.jdbc and javax.jdbc

  2. java.jdbc and java.jdbc.sql

  3. java.sql and javax.sql

  4. java.rdb and javax.rdb


Correct Option: C

AI Explanation

To answer this question, we need to understand that JDBC (Java Database Connectivity) is a Java API that provides a standard way to interact with relational databases. The JDBC classes are part of the Java standard library and are contained in the java.sql package.

Let's go through each option to understand why it is correct or incorrect:

Option A) java.jdbc and javax.jdbc - This option is incorrect because there is no package named java.jdbc or javax.jdbc. The correct package is java.sql.

Option B) java.jdbc and java.jdbc.sql - This option is incorrect because there is no package named java.jdbc.sql. The correct package is java.sql.

Option C) java.sql and javax.sql - This option is correct because the JDBC classes are contained in the java.sql package. The javax.sql package also contains additional JDBC-related classes and interfaces.

Option D) java.rdb and javax.rdb - This option is incorrect because there is no package named java.rdb or javax.rdb. The correct package is java.sql.

The correct answer is C. The JDBC classes are contained in the java.sql package, and the javax.sql package contains additional JDBC-related classes and interfaces.

Find more quizzes: