0
Why the output is hi when x=7,if(x<42)
I know how I can use it but don't know how it's getting executed
6 Answers
+ 3
There is no output given in that code.
+ 2
if (7 is less then 42){ do somthing();}
+ 1
@shikhar
your missing a semicolon in your code at the end of the print method();}
also use // for single line comments
also
int x = 7;
your initalizing x to a value here so x uses 7.
0
output is getting as Hi
Not understand in it's reason
0
why we are taking x as 7
0
public class{
public static void main(String[ ] args)
{
int x =7;
if(x < 42);{
System.out.println("Hi")
}
}
}
/ result is Hi/