+2 votes
in Class 12 by kratos

Consider the following code and answer the questions that follow:

String query = "SELECT NAME,EMAIL FROM CONTACT"

ResultSet rs = stmt.executeQuery(query) ; //Statment1

if (rs.next()) //Statement2

{ String Name = rs.getString("Name");

String Email = rs.getstring("Email");

jTextField2.setText(Name);

jTextField3.setText(Email);

}

(i) Name the table from where the data is being retrieved.

(ii) How many objects of the native String class have been declared in the code?

Name the objects.

(iii) Identify the object name, class name and method name used in the statement labeled as Statement1.

(iv) Explain the function of the statement labelled as Statement 2.

1 Answer

+6 votes
by kratos
 
Best answer

(i) CONTACT

(ii) 2. Name , Email

(iii) ClassName -ResultSet Object- rs method - executeQuery()

(iv) rs.next() - fetches the next record from the result set

...