Question: I am having trouble with this problem, I'm not sure about how to produce an output from the Drill2 class because the terminal says that

I am having trouble with this problem, I'm not sure about how to produce an output from the Drill2 class because the terminal says that system.out.println() package system does not exist. Below is the code that I've added to the bottom of the code that is given.

class Drill2 {

>public static void main (String [] args) {

>>C2 first = new C2(10);

>>C2 newC2 = new C2(2);

>>C1 second = new C1(newC2);

>>C1 third = new C1(first);

>}

}

I am having trouble with this problem, I'm not sure about how

In the file Drill2 - java, add the following class definitions (you can copy/paste them from here): class C1{ C2 other; c1 (C2 other) \{ this.other = other; \} class c2 \{ int x; C2(int x){ this. x=x; \} Then add a class definition called Drill2 with the following fields: - A field named first of type c2 with its x field equal to 10 - A field named second of type C1. It's value should be a reference to a C1 object with its other field set to any C2 object other than the one stored in first (you can create another c2 object for this). - A field named third of type Cl. It's value should be a reference to a Cl object with its other field the same C2 object as the one stored in the first field

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!