Is this valid ?
def CallableStatement st
try {
...
st = sqlConn.prepareCall("call....")
...
}
what I’m really worried about is can you specify type and also use def at the same time?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes and no….
Yes, because the compiler will happily compile and execute the code above, but no, because it really doesn’t make any sense to type something as
defand also assign it as an explicit type. Basically what you’re saying is “this can have any type, but it must be aCallableStatement“. In my opinion, the definition above should generate a compiler error.In practice this definition:
Appears to be identical to:
As the following illustrates: