In Java you are able to do the following:
new Object[] { /* parameters separated by comma */};
Indeed, this is used in the prepared statements of the Spring framework. Eg:
getJdbcTemplate().queryForList(
"DELETE FROM foo WHERE id = ?", //the "?" mark will be substituted by "3"
new Object[] { 3 }, //What kind of magic is this?
String.class //Irrelevant in this example
);
Object[] objs = new Object[]{3,4};
is the same as:
Object[] objs = new Object[2];
objs[0] = 3;
objs[1] = 4;
So you access it as objs[0];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With