Whats wrong with my code didnt able to recognised in boolean precedence


<Below this line, add a link to the EXACT exercise that you are stuck at.>

<In what way does your code behave incorrectly? Include ALL error messages.>


Replace this line with your code.

<do not remove the three backticks above>

Please can you provide us with a bit more context to the problem?

Ideally: The code, instruction in question and any error messages you received.

public class Precedence {
public static void main(String args) {

	boolean riddle = ( !(1 < 8)&& (5 > 2 || 3 < 5));



this is my code but answer is coming false still it showing theres something wrong im unable to get …

Almost! Did you use each Boolean operator no more than one time?
this error is being displayed to me

Okay I see.

You’re code is technically right, because it evaluates to false and you used all the operators like it asked for. But the lesson logic which tests to see if you have done the right thing is counting your solution as a not pass because for one reason or another it believes you didn’t accomplish the task.


  boolean riddle = /**/( 1 < 8 /**/ (5 > 2 /**/ 3 < 5));    //----> Default code
//boolean riddle = (  !( 1 < 8) &&  (5 > 2  ||  3 < 5));      ----> Your code

Where those comments are in the first line of the above code is more or less where the lesson is expecting you to make changes. So try limiting your alterations in those areas and see if the exercise will let you pass.

sry but i didnt get what u said plz explain in precise …

i got it thanx a lot …

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.