• +91 9723535972
  • info@interviewmaterial.com

JDBC Interview Questions and Answers

Question - What is the use of the getter and setter methods in ResultSet?

Answer -

Getter methods: These are used to retrieve the values of the particular column of the table from ResultSet. Either the Column Index value or Column Name should be passed as a parameter. Normally, we will represent the getter method as getXXX() methods.

Example:

  • int getInt(string Column_Name): It is used to retrieve the value of the specified column Index and int data type as a return type.
Setter Methods: We can set the value in the database using ResultSet setter methods. It is similar to getter methods, but here we need to pass the values/data for the particular column to insert into the database and the index value or column name of that column. Normally we will represent the setter method as setXXX() methods.

Example:

  • void setInt(int Column_Index, int Data_Value): It is used to insert the value of the specified column Index with an int value.

Comment(S)

Show all Coment

Leave a Comment




NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners