-
public static void executebindParam(PreparedStatement pstmt,Object ...os){
-
int len = os.length;
-
try {
-
for (int i = 0; i < len; i++) {
-
pstmt.setObject(i+1, os[i]);
-
}
-
} catch (SQLException e) {
-
e.printStackTrace ();
-
}
-
}
Object ... os The wording is from the beginning of Java 5, Java language method parameters to support a new wording, called variable-length argument list.
Represents a parameter as an object here to accept a plurality of type Object to 0, or an Object []
Note that the format of the variable length argument list:
- Parameter types and "..." do not have to have a space (Object ... os) between the three points, Object ... os does not report an error;
- Variable-length argument lists this parameter must be the last argument in the argument list, or will be error