ExamVeda
Login
Home
Interfaces and Abstract Classes
?

What will be the output of the following Java code?
class A 
{
     int x;
     int y;
     void display() 
     {
          System.out.print(x + " " + y);
     }
}
class Output 
{
     public static void main(String args[]) 
     {
         A obj1 = new A();
         A obj2 = new A();
         obj1.x = 1;
         obj1.y = 2;
         obj2 = obj1.clone();
         obj1.display();
         obj2.display();
     }
}

Answer & Solution
Correct Answer: Option B
Let's discuss the solution. Join the discussion
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.