What is the output? And describe the error? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the output? And describe the error?

https://code.sololearn.com/clSu3MCnATze/?ref=app

8th Nov 2019, 1:24 PM
Abanikanta Biswal
Abanikanta Biswal - avatar
4 Answers
+ 4
Within the IF, you must use == to indicate a comparison. When you only use an =, the code understands that you are DECLARING the value of the variable, not comparing therefore, replace X = 10 with x == 10 within the IF
8th Nov 2019, 1:32 PM
Wardy Spirit
Wardy Spirit - avatar
+ 1
public class Program { public static void main(String[] args) { int x=5; if(x==10){ System.out.println ("Hii"); } else{ System.out.println("hello"); } } } here for me its compiling correctly
8th Nov 2019, 1:37 PM
Wardy Spirit
Wardy Spirit - avatar
0
And its show compile time error.
8th Nov 2019, 1:34 PM
Abanikanta Biswal
Abanikanta Biswal - avatar
0
Hello
15th Nov 2019, 4:55 PM
Aldair