在Java中,您可以执行以下操作:
new Object[] { /* parameters separated by comma */};
Run Code Online (Sandbox Code Playgroud)
实际上,这是在Spring框架的预准备语句中使用的.例如:
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
);
Run Code Online (Sandbox Code Playgroud)
小智 14
Object[] objs = new Object[]{3,4};
Run Code Online (Sandbox Code Playgroud)
是相同的:
Object[] objs = new Object[2];
objs[0] = 3;
objs[1] = 4;
Run Code Online (Sandbox Code Playgroud)
所以你以objs [0]的形式访问它;
| 归档时间: |
|
| 查看次数: |
15332 次 |
| 最近记录: |