adplus-dvertising
frame-decoration

Question

What is the output of this program?
    class Output 
    {
        static void main(String args[]) 
        {    
             int x , y = 1;
             x = 10;
             if(x != 10 && x / 0 == 0)
                 System.out.println(y);
             else
                 System.out.println(++y);
        } 
    }

a.

1

b.

2

c.

Runtime Error

d.

Compilation Error

Posted under Java Programming

Answer: (d).Compilation Error

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of this program?