Home / MCQ Bank / Computer
Computer Overriding And Overloading

What will be the output of the following Java code? class test { int a; int b; test(int i, int j) { a = i; b = j; } void meth(test o) { o.a *= 2; O.b /= 2; } } class Output { public static void main(String args[]) { test obj = new test(10 , 20); obj.meth(obj); System.out.println(obj.a + " " + obj.b); } }

Select the best option to verify your answer:
Show Correct Answer
Correct Answer: Option B • 20 10

Related Computer Questions

What function is used to create a new variable in a dplyr data frame based on existing variables? Which of the following is the allocation method of a disk space? How many functions does PHP offer for searching strings using POSIX style regular expression? In Java, can a "try" block have multiple "catch" blocks? What will be the output of the following C++ code? #include <stdio.h> #include<iostream> using namespace std; int main () { int array[] = {0, 2, 4, 6, 7, 5, 3}; int n, result = 0; for (n = 0; n < 8; n++) { result += array[n]; } cout << result; return 0; }