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,r,s;
    p=q=r=s=10;
    p+=q-=r*=s/=10;
    System.out.println(p+" "+q+" "+r+" "+s);

    }
    }
    1. 20 0 20 1
    2. 10 0 10 1
    3. 10 0 0 10
    4. 20 0 0 20
    5. 10 10 0 1
Correct Option: B

Expression will evaluate from right to left.
output: 10 0 10 1



Your comments will be displayed only after manual approval.