Question: What is the output of the following Java program? public class MyClass { int a, b; MyClass() { a = 1; b = 2;
What is the output of the following Java program? public class MyClass { int a, b; MyClass() { a = 1; b = 2; } 10 2 15 16 17 public void print(){ } System.out.println(a + " + b); public static void main(String[] args) { MyClass x = new MyClass(); MyClass y = x; x. a++; x.b++; y.print(); 18 19 }
Step by Step Solution
There are 3 Steps involved in it
Title Find output Output The outp... View full answer
Get step-by-step solutions from verified subject matter experts
