常规If语句中的奇怪Java问题

时间:2013-03-24 18:49:54

标签: java android

我正在eclipse中开发一个Android应用程序,我有这个if语句:

private static final int MAX_FREQ=2484;
private static final int MIN_FREQ=2412;

if ((freq >= MIN_FREQ) && (freq <= MAX_FREQ)){
        return true;     
    }

freq是2462,由于某些奇怪的原因,它无法进入声明。当我将源更改为:

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;     
    }

这个有用......: - /?我错过了什么?

1 个答案:

答案 0 :(得分:1)

试试这个:

    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;     
    }