Given:
What is the output?
Given:
What is the output?
In Java, when you perform arithmetic operations on primitive types, they are promoted to at least int if they are smaller. In this case, the byte (x) and short (y) are added together, resulting in an int value of 25. Since the class Test does not have a method process that accepts an int, the Java runtime will look for a suitable method which can take an argument that can be assigned from int. The only method that matches this requirement is process(Object v), because an int can be autoboxed to an Integer which is an Object. Thus, the method process(Object v) is called and the output is 'Object value 25'.
D is correct TESTED
The output of the code is D. Object value 25. The code compiles and runs without any errors. In the expression x+y, both operands are promoted to int before the addition is performed, resulting in an int value of 25. Since there is no process method that takes an int argument, the int value is then boxed into an Integer object and passed to the process(Object v) method, which prints Object value 25.
tested : D x+y => boxed to int and boxed to Integer
Tested: D.
Answer: D x+y becomes int
D is correct because Object class is base class for every object.
The correct answer is D