-
What is the output of this program?
public class Result
{
static void main(String args[])
{
int p , q = 1;
p = 20;
if(p != 20 && p / 0 == 0)
System.out.println(q);
else
System.out.println(++q);
}
}
-
- 2
- 0
- Compilation error
- Runtime error
- None of these
Correct Option: C
main() method must be made public. Without main() being public java run time system will not be able to access main() and will not be able to execute the code.