Question: whats the output public class TestobjectX2 { public static void main(String[] args) { objectX2 c1 = new objectX2(); objectX2 c2 = new objectX2(4); objectX2 c3

whats the output

public class TestobjectX2 { public static void main(String[] args) { objectX2 c1 = new objectX2(); objectX2 c2 = new objectX2(4); objectX2 c3 = new objectX2(1); c2.setX(5.0); c3 = c1; System.out.println(c2.getX()); System.out.println(c3.getX()); System.out.println(c1.x02); } } public class objectX2 { private double x01; static int x02 =1;

objectX2() { x01 = 2.0; x02++; } objectX2(double y) { x01=y; x02++; } double getX() { return x01 * x01; } public void setX(double x03) { if( x03 >= 0) x03 = 1; else x01 = 0; } }

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!