Home » JAVA Programming » Basic Operators » Question
  1. What is the output of this program?

    public class Result
    {
    public 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);
    }
    }
    1. 0
    2. 1
    3. 2
    4. 3
    5. 4
Correct Option: C

Output: 2



Your comments will be displayed only after manual approval.