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 classa) 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.
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.