Compare Booloean without variables, so don't use numbers?


#1


https://www.codecademy.com/en/courses/learn-java/lessons/introduction-to-java/exercises/equality-operators


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

		System.out.println(BlahBlah == NahNah);

	}
}


#2

I'm a little confused on what you're asking. So you are trying to get a boolean value printed without using variables?


#3

Yeah, it says use any equality operator to directly compare two booleans. What I got from that is put 2 things == to each other, but it's not working and that's where I'm lost.


#4

Does something like this work?:
System.out.println(true==true); - to get true or,
System.out.println(false==true); - to get false?

What does it say when you try to submit your code? (Im guessing something along the lines of the variables being undefined?)


#5

You have that right except that you can use other comparison operators besides == if you want. Not just any two things though, two Boolean values. There are only two Boolean values to choose from: true and false.


#6

Thank you, I didn't realize true and false were the only things I could put!


#7

I understand now true and false are the only understandable answers. thanks for clearing this up!


#8

It can get a little confusing sometimes, essentially like @albionsrefuge said a boolean value is either true or false. A variable can be assigned a boolean value and used like this:
Boolean isActive = true;
System.out.println(isActive);
-> Prints: True

or a comparison using comparison operators will return a boolean (==, != , <, >, ... etc.)
System.out.println(1==3); -> Prints: False
System.out.println(1!=3); -> Prints: True


#9

you can use numerals to compare as boolean.
like this:-

System.out.println(1==3); -> Prints: False
System.out.println(1!=3); -> Prints: True

this will do for sure!