+ 1
What is the output? And describe the error?
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
+ 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
0
And its show compile time error.
0
Hello