Shouldn't square braces followed by curly braces cause an error for array initialization?

This question is from the context of using the Spring 3 framework with a GWT front end as generated by the Spring Scaffolding process. Question 1 = There are two questions I have for the block below. One iis the 'new String[] { key };' part. How is it okay to have the square brackets with curly braces directly after them? Shouldn't square braces followed by curly braces cause an error for array initialization? Question 2 = Also, it says that this method returns the Primary Key fields in the order they are required by the DAO layer, but it looks like this method could return a maximum of one key with the Object[] and the keyValuesAsText[]. Since the input is only a String how could that possibly be expanded to return an array of keys for DAO objects? Since this is my first question on stackoverflow any suggestions would be appreciated as to the quality of the question and the way I asked the question. code -- /** * Returns the Primary Key field values in the order they are required by the DAO layer to find by primary key * @param key * @return */ protected Object[] getPrimaryKeysFromGoogleKey(String key) { String[] keyValuesAsText = new String[] { key }; Object[] keyValues = new Object[keyValuesAsText.length]; keyValues[0] = new Integer(keyValuesAsText[0]); return keyValues; }

以上就是Shouldn't square braces followed by curly braces cause an error for array initialization?的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏