0

I am developing an Android App in eclipse and I have this if statement:

private static final int MAX_FREQ=2484;
private static final int MIN_FREQ=2412;
if ((freq >= MIN_FREQ) && (freq <= MAX_FREQ)){
 return true; 
 }

The freq is 2462 and for some odd reason it fails to get into the statement. When I change the source into:

private static final int MAX_FREQ=2484;
private static final int MIN_FREQ=2412;
if ((freq >= MIN_FREQ) && (freq <= MAX_FREQ)){
 Log.e(TAG,""Bla Bla");
 return true; 
 }

this one works ... :-/ ? What am I missing ?

7
  • 7
    The second one can't possibly work: it cannot compile. Commented Mar 24, 2013 at 18:51
  • That shouldn't happen, sometimes Eclipses get's confused and it looks like you fixed it by cleaning / rebuilding your project. (I'm assuming those typos are just here in your question.) Commented Mar 24, 2013 at 18:51
  • 1
    Missing brace in the second statement compile time error Commented Mar 24, 2013 at 18:52
  • What am I missing ? - ( Commented Mar 24, 2013 at 19:03
  • Compiler optimization gone awry, not retaining the line number? Commented Mar 24, 2013 at 19:07

1 Answer 1

1

Try this:

 private static final int MAX_FREQ=2484;
private static final int MIN_FREQ=2412;
if ((freq >= MIN_FREQ) && (freq <= MAX_FREQ)) //missing (
 {
 Log.e(TAG,"Bla Bla"); //Semicolon missing in your code and two " signs together
 return true; 
 }
answered Mar 24, 2013 at 18:54
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.