Exercise 11



If you need help with this exercise as how they word the exercise was difficult to understand.
Question : Use any equality operator to directly compare two Boolean values. Do not declare any variables.

They want you to use 2 true or false values (Boolean), but you cannot compare variables, I think by variables they mean the use of myChar or myInt as shown in the exercise example.
The code below will print out a false, obvious reasons.

System.outprintln(5 == 3)


You're comparing two ints, you should compare two booleans


Okay, but it still works, thats what I don't understand.


Depends on what you mean by "works" doesn't it?

BTW, that doesn't compile, so a huge portion of all the possible interpretations of "working" go straight out through the window because it doesn't do any work.


All to true! This is an introductory course for a reason as I have no experience in coding. Where you seem like you do. The question isn't very clear, I tried a code and it was very simple and the program said I did it right. I don't fully understand how and why it was right. Obviously it isn't right in the theoretically correct way as you seem to note. So can you give me an example of what is right and try and clear up the fog for me?