0

i dont know why but can anyone explain why output is "no output"

public class Program { public static void main(String[] args) { int x = 7; if(x < 42) { System.out.println("Hi"); elseif {System.out.println("yo");} } } }

14th Aug 2016, 11:20 AM
KARTHI KHEYEN (IMPULSEKARTHI)
KARTHI KHEYEN (IMPULSEKARTHI) - avatar
8 Answers
+ 4
public class Program { public static void main(String[] args) { int x = 7; if(x < 42) System.out.println("Hi"); else System.out.println("yo"); } }
14th Aug 2016, 11:36 AM
Paula Ariton
Paula Ariton - avatar
+ 1
the else if statement is included in the if braces...so it will show only hi...better to use braces even if there is single statement â˜ș
26th Aug 2017, 2:22 PM
ayyappa reddy konala
0
I think it is compile error rather than no output.
14th Aug 2016, 3:31 PM
WPimpong
WPimpong - avatar
0
there is a structure error.
14th Aug 2016, 3:48 PM
Gowtham krvz kv
Gowtham krvz kv - avatar
0
you have not given space between else if . it should be else if or you can write simply else
17th Aug 2016, 1:32 PM
kavitha v p
0
Incorrect placement of curly braces. The braces that you started after if contains an else if clause without if clause that's why there is no output. Rest everything is correct
11th Sep 2016, 5:11 AM
Ishan Mishra
Ishan Mishra - avatar
0
which one i use for else statement..else or else if.which one is correct.any one can explain here please:-(
17th Sep 2016, 1:16 PM
vijendiran
0
/* You have to be careful while writing the coding as little mistake on your codes will leads to many error. First of all if you want to learn Java properly use Command Prompt to run your programmes and write your code on text editor(like Notepad++, Sublime Text etc) it . And about your error here, there are many syntex error. So the corrected code will be : */ public class Program { public static void main(String[] args) { int x = 7; if(x < 42) { System.out.println("Hi"); } else { System.out.println("yo"); } } } //keep coding
4th Oct 2016, 7:59 AM
Prosper Patel
Prosper Patel - avatar