Home / Questions / What are the values of a and b after the following function is executed, if the values passed are 30 and 50: void paws(int a, int b) { a=a+b; b=a–b; a=a–b; System.out.println(a+ "," +b); }
Explanatory Question

What are the values of a and b after the following function is executed, if the values passed are 30 and 50:

void paws(int a, int b)
{
    a=a+b;
    b=a–b;
    a=a–b;
    System.out.println(a+ "," +b);
}

👁 100 Views
📘 Detailed Answer
🕒 Easy to Read
Read the answer carefully and go through the related questions on the right side to improve your understanding of this topic.

Answer with Explanation

Value of a is 50 and b is 30.
Output of the code is:


50,30