GeneralizationsB.Java Beginner Problem


I’m having what is probably an easy fix for most of you, but I am stuck on this one. How is the first line in this exercise supposed to go?
<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.> error: not a statement
( 3 >= 3 && true || !true );
1 error


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

( 3 >= 3 && true || !true ); 
boolean tricky = true;	
<do not remove the three backticks above>

This expression it’s not a statement because nothing is being done with it. The way it’s written is like a vague information. So you need to do something with it to be considered a statement. Try to store the result of this expression in a variable. See you!

Here are my instructions:
Use the precedence rules to help you evaluate the Boolean expression in the single line comment above the tricky variable.

Then, set the boolean variable tricky equal to the result (either true or false).

My code is me trying to do that, can someone explain to me how to do that? Please?

Hey man I was dealing with the same problem, I failed to notice the !true making the statement false. Change that statement back to a single line comment //(statement) then make Boolean tricky = false

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