Computer Applications
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);
}
User Defined Methods
ICSE 2015
24 Likes
Answer
Value of a is 50 and b is 30.
Output of the code is:
50,30
Answered By
12 Likes
Related Questions
Method prototype for the method compute which accepts two integer arguments and returns true/false.
- void compute (int a, int b)
- boolean compute (int a, int b)
- Boolean compute (int a,b)
- int compute (int a, int b)
Invoking a method by passing the objects of a class is termed as:
- Call by reference
- Call by value
- Call by method
- Call by constructor
Method which reverses a given number is:
- Impure method
- Pure method
- Constructor
- Destructor