Link to home
Start Free TrialLog in
Avatar of perdoname_
perdoname_

asked on

Variable might not have been initialized ????

Hey experts,
I get this error "Variable userInp might not have been initialized"  to the below code:

                        answer = Calculator(userInp, op1 , op2) + answer.substring(indexR + 1);

does anyone knows why im getting this error ??

Avatar of sciuriware
sciuriware

answer and indexR    should have some value before you can get a substring or index the substring.

What's the rest of the code prior to this one?

;JOOP!
In Java, all the local variables should be initialized before you can use
them.
ASKER CERTIFIED SOLUTION
Avatar of ronghao
ronghao

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial