Question: Consider the following program: Mark all of the lines of code that have a compilation error. For each compilation-error line, explain why it is incorrect.

Consider the following program:

public class Test { private static int x; private int y; public static void doIt() { } Test.x this.y } = X =

  1. Mark all of the lines of code that have a compilation error. 
  2. For each compilation-error line, explain why it is incorrect.
    For each compilation error, just provide the reason that the error occurs. Do not try to solve the problem by attempting to show a “fixed” version of the program.

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

Step by Step Solution

3.46 Rating (149 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The code sample provided is written in Java and there are several lines that will cause compilation ... View full answer

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 Introduction To Programming With Java A Problem Solving Approach Questions!