0
What is the error?
5 Antworten
+ 6
Kumar Anshuman
if (x >= 5) {
+ 4
= is an assignment operator
i.e if you want to assign value of x to someone you use =
while == is comparison operator .
== returns true if both its left and right side expressions are equal .
i.e
x==y returns true if x is equal to y
Lesson 10 under conditionals and loops : https://www.sololearn.com/Course/Java/?ref=app
+ 3
Kumar Anshuman in java there should be a condition which returns boolean value in if any non-boolean value will show error
+ 3
Thanks to all. 😇
I got it.
+ 1
@Prashanth Kumar
By writing x=5 I am assigning the value 5 to x which is a non zero number.So it must be true.
Hence, the compiler should print "Hi" on the screen but it shows an error. Why?