-5

Hey i have this code in java:

If (Yes.isChecked()){
                FreeEvent = "True";
            } else{
                FreeEvent = "False"; }

Yes is a radio button and FreeEvent is a string and both are setup fine. I want to execute Line2 if the radio button Yes is checked, any ideas why this method isn't working? Error is "Cannot resolve method 'If(boolean)'

Roman C
  • 49,761
  • 33
  • 66
  • 176
user3001471
  • 37
  • 2
  • 7
  • did you implement onCheckedChangeListener? – Jimmy Dec 23 '13 at 19:11
  • The error is a typo: he wrote `If` instead of `if`. This question shouldn't even be answered. – karlphillip Dec 23 '13 at 19:13
  • 1
    While I disagree that this question 'shouldn't be answered' on the basis of the problem simply being a typo, I Googled the error message and the top hit was the duplicate linked above, with an accepted answer of how to fix this - for _this_ reason it gets my close vote. – Adam S Dec 23 '13 at 19:18
  • I also disagree that this question shouldn't be answered because it's "just a typo." This question has a clear answer and is useful to beginner programs (clearly, at least two people have had this problem.) In fact, I think people should go back and upvote the question this duplicates. – Kevin Dec 23 '13 at 19:25
  • By the way, welcome to Stack Overflow, user3001471! Most questions have at least some conversation criticising them, and even the most experienced users occasionally post a question that is closed or downvoted. I'm sorry your question got a frosty reception, and I hope you continue contributing here! – Kevin Dec 23 '13 at 21:22

1 Answers1

3
if (Yes.isChecked()){

not

If (Yes.isChecked()){

(lower case i )

MByD
  • 135,866
  • 28
  • 264
  • 277