Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started