Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

V 20 Find the output of the following program: public class myPoint ( private int x; private int y; private static int count=0; public

   

V 20 Find the output of the following program: public class myPoint ( private int x; private int y; private static int count=0; public myPoint (int a, int b) { x=a; y=b; count++; } 20 public myPoint ( ) { x=0;y=0; count++; } public void add () { x=x+y; } public void add (int a) { x=y+a; count--; } public static int getCount() { return count; }-2 public int getX() { return x; } public int getY() { return y; } 20 = y } 2 1 2 public class itemDemo { public static void main(String args[]) { }// end of class myPoint Pl=new myPoint (10, 20); myPoint P2=new myPoint (1, 2); o System.out.println (P1.getX()); System.out.println (P2.getX()); 2-int M P1.getCount(); M 2 System.out.println (M); P1.add (M); System.out.println (P1.getX());

Step by Step Solution

3.39 Rating (149 Votes )

There are 3 Steps involved in it

Step: 1

It seems like there are some syntax errors and missing parts in the provided code snippet Ill try to ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Building Java Programs A Back To Basics Approach

Authors: Stuart Reges, Marty Stepp

5th Edition

013547194X, 978-0135471944

More Books

Students also viewed these Programming questions