0

What's the error in this Java program?

public class MyClass { public static void main(String[] args) { int x = 42; if (x < 36) { System.out.printIn("hi"); } else { System.out.printIn("hey"); } } }

2nd Jun 2017, 12:37 PM
Jeff Mathew
Jeff Mathew - avatar
7 Answers
+ 16
You wrote System.out.print(Capital i)n instead of System.out.print(Small L)n
2nd Jun 2017, 12:42 PM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
+ 12
@Jeff : I deleted my post. I didn't write the same code. "Capital i" and "Small L" look identical.
2nd Jun 2017, 1:20 PM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
0
Yes... Exactly as krishna said... Good one though... Hard to say without compiling
2nd Jun 2017, 12:52 PM
Debayan Ghosh
Debayan Ghosh - avatar
0
Can you write the correct coding after if(x < 36)
2nd Jun 2017, 12:55 PM
Jeff Mathew
Jeff Mathew - avatar
0
right Can u tell the output if in your program after x=42 for(int i=0;i<=x/2;i+3) System.out.println(x*x-3); What will be the output ? No other codes Program ends there
2nd Jun 2017, 1:05 PM
Debayan Ghosh
Debayan Ghosh - avatar
0
Krishna You wrote the same code as mine
2nd Jun 2017, 1:18 PM
Jeff Mathew
Jeff Mathew - avatar
0
Oh didn't get that at first Thanks a lot @krishna
2nd Jun 2017, 1:24 PM
Jeff Mathew
Jeff Mathew - avatar