9th Sep 2022, 3:35 AM
Kumar Anshuman
5 Antworten
+ 6
Kumar Anshuman if (x >= 5) {
9th Sep 2022, 4:23 AM
BroFar
BroFar - avatar
+ 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
9th Sep 2022, 3:39 AM
Prashanth Kumar
Prashanth Kumar - avatar
+ 3
Kumar Anshuman in java there should be a condition which returns boolean value in if any non-boolean value will show error
9th Sep 2022, 4:39 AM
Randeep Singh
Randeep Singh - avatar
+ 3
Thanks to all. 😇 I got it.
9th Sep 2022, 4:53 AM
Kumar Anshuman
+ 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?
9th Sep 2022, 3:45 AM
Kumar Anshuman