Question: trase the code in java below: public class Trace { static int x, y; int z; public Trace() { x++; z++; } public static void
trase the code in java below:
public class Trace {
static int x, y;
int z;
public Trace() {
x++;
z++;
}
public static void main(String[] args) {
int x = 1;
int k = 3;
Trace t1 = new Trace();
Trace t2 = new Trace ();
Trace t3 = new Trace ();
for (int j=0; j<10; j++)
increment(t1, x);
System.out.println(t1.x + " " + t1.y + " "+ x);
{
int y = 3;
System.out.println(t2.x + " " + t2.y + " "+ y);
}
k = x + y;
System.out.println(k + " " + y + x);
System.out.println(t3.x + " " + t3.y + " " + t3.z);
}
public static void increment(Trace t, int x)
{
t.x++;
t.y--;
x++;
}
}
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
