Question: Given the following programs, write the output in Object-oriented programming public class A { public class Main private int x; public AO { System.out.println(Good luck..);

Given the following programs, write the output in Object-oriented programming Given the following programs, write the output in Object-oriented programming public class

public class A { public class Main private int x; public AO { System.out.println("Good luck.."); public static void main(String[] args) { A al = new A(5); A a2=al; A a3 = new A(10); A a4 = method(al,a3); A a5=al; a2 = new A(15); public A(int x) { this.x = x; public int getX() { return x; 3 System.out.println("al:"tal.getX(); System.out.println("a2: "+a2.getX(); System.out.println("a3 : "+a3.getX(); System.out.println("a4 : "+a4.getXO): System.out.println("a5 : "+a5.getX(); public void setX(int x) { this.x = x; A a6 = new AC; } static A method(A al,A a2){ al.setX(20); a2.setX(30); return new A(40); 3 }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!