1.

Explain the usage of the getter and setter methods in ResultSet.

Answer»
  • Getter methods: These are used for retrieving the particular column values of the table from RESULTSET. As a parameter, EITHER the column index value or column NAME should be PASSED. Usually, the getter method is represented as getXXX() methods.
    Example:
    int getInt(string Column_Name)

The above statement is used to retrieve the value of the specified column Index and the return type is an int data type.

  • SETTER Methods: These methods are used to set the value in the database. It is almost similar to getter methods, but here it requires to pass the data/values for the particular column to insert into the database and the column name or index value of that column. Usually, setter method is represented as setXXX() methods.
    Example:
    void setInt(int Column_Index, int Data_Value)

The above statement is used to insert the value of the specified column Index with an int value.



Discussion

No Comment Found