How to avoid setting variable in a try statement

前端 未结 4 1449
轻奢々
轻奢々 2020-12-22 04:45

My problem is that I have to set a variable in a try statement otherwise I get a compile error.

Later on I need to use that variable but it is now out of scope, or s

4条回答
  •  粉色の甜心
    2020-12-22 05:39

    Why don't you simply add a

    if(rs != null)
    

    before

    while(rs.next())
    

    This should help (as far as I understand it)

提交回复
热议问题