Java return value (in try/catch clause)

后端 未结 6 365
生来不讨喜
生来不讨喜 2021-01-12 17:25

everyone. I have a rookie question about the returning value in java. Here\'s my code.

@Override
public long addDrugTreatment(long id, String diagnosis, Stri         


        
6条回答
  •  再見小時候
    2021-01-12 18:07

    There's a route through your code which means there would be no return value defined, which is an error, since your method says you'll always return a long.

    Are you expecting a value to be returned when if the code throws a JMSException? If so, perhaps declare tld outside the try with a default value.

    Else did you really mean to re-throw the JMSException?

提交回复
热议问题