Examveda
Examveda

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);        
    } 
}

A. 10 20

B. 20 10

C. 20 40

D. 40 20

Answer: Option B


This Question Belongs to Java Program >> Overriding And Overloading

Join The Discussion

Related Questions on Overriding and Overloading