2023年8月3日发(作者:)
(args)传参问题本来要写个public void id)删除函数调⽤(String sql, args)然后发现这样写会报错,因为⼏把参数是Object类型(赛林⽊,这是引⽤类型),⽽int是基本类型,我传进去的却是int类型数组 public void deleteUser(int id) { String sql = "delete from user where id=?"; try { (sql, id); } catch (DataAccessException e) { tackTrace(); } }但是这么写却没错,有可能⾃动转Object了,不太懂。所以要正确使⽤,要传Integer类型进去
2023年8月3日发(作者:)
(args)传参问题本来要写个public void id)删除函数调⽤(String sql, args)然后发现这样写会报错,因为⼏把参数是Object类型(赛林⽊,这是引⽤类型),⽽int是基本类型,我传进去的却是int类型数组 public void deleteUser(int id) { String sql = "delete from user where id=?"; try { (sql, id); } catch (DataAccessException e) { tackTrace(); } }但是这么写却没错,有可能⾃动转Object了,不太懂。所以要正确使⽤,要传Integer类型进去
发布评论