Problem

Consider the following program.public class Test{ private int x; private static int y;...

Consider the following program.

public class Test{   private int x;   private static int y;   public void doIt()   {      x = 1;      y = 2;   }   public static void tryIt()   {      x = 3;      y = 4;   }   public static void main(String[] args)   {      doIt();      tryIt();      Test t = new Test();      t.doIt();      Test.doIt();      Test.tryIt();   }} // end Test class

a) Mark all of the lines of code that have a compilation error.


b) For each compilation-error line, explain why it is incorrect.

Note:

There are no errors in the variable declarations and there are no errors in the method headings, so don’t mark any of those lines as having an error.

For each compilation error, just provide the reason that the error occurs. In particular, do not solve the problem by attempting to show a “fixed” version of the program.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT