Different outcome then I expected, please help!


#1


https://www.codecademy.com/courses/learn-java/lessons/conditionals-control-flow/exercises/generalizations-conditionals

I tried to make the code decide wether the expression is true :


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


 boolean tricky = ( 3 >= 3 && !(true || true)) ;

	if(tricky = true) {

			System.out.println("Stuck in the past...");

		}else {

			System.out.println("Upgraded to the future!");

		}

The output of the code is "Stuck in the past", so my code tells me tricky is true.. but ( 3 >= 3 && !(true || true)) is false.
Could you guys please tell me what i'm doing wrong?


#2

= is used for assigning values to a variable.
== is for comparing values.


#3

thanks very very much!


#4

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