0

Unable to understand its output. how this operators works? Problem given below. Please help to figure it out

public static void main(String[] args) {
    int p = 11;
    int q = 21;
    int r;
    int s;
    r = ++q;
    s = p++;
    r++;
    System.out.println("value of r : " + r);
    System.out.println("value of s : " + s);
}

Here the output is, value of r : 23 value of s : 11. The r++ increased the value by 1 but when s=p++ its didn't increases its value? Unable to understand why? why here r value increased but not s value?

Iam Srkfan
  • 197
  • 9

0 Answers0