Question: I know the output for this java program. But I need step by step how was this code exacted. public class alpha_0 { int x,y,
I know the output for this java program. But I need step by step how was this code exacted.
public class alpha_0 { int x,y, z = 10; public alpha_0() { x = 79; y = 69; } void stuff() { System.out.println("Ax " + x); } void animaniacs() { System.out.println("hnpp"); } void stuff(int z) { System.out.println("By " + y); } } public class beta_0 extends alpha_0 { public beta_0(int x) { this.x = 11; y = x; } void stuff(int y) { System.out.println("Cz " + x); } void animaniacs() { System.out.println("narf"); } } public class gamma_0 extends beta_0 { public gamma_0(int x) { super(x); y = 8; } void stuff() { System.out.println("E Boingy"); super.stuff(); } } void goodIdea_0(alpha_0 var) { System.out.println("ROTSC"); var.animaniacs(); } int badIdea_0(alpha_0 var) { int x = 0; return(var.x / x); } int main_0() { int[] arr= new int[4]; arr[0] = 95; arr[2] = 786; arr[3] = -536; arr[1] = 502; //Contents of arr: _____ _____ _____ _____ alpha_0 c = new alpha_0(); alpha_0 b = new beta_0(3); alpha_0 a = new gamma_0(0); a.stuff(13); c.stuff(); goodIdea_0(b); goodIdea_0(c); goodIdea_0(a); b.stuff(); c.stuff(5); b.stuff(10); a.stuff(); arr[3] = 308; //Contents of arr: _____ _____ _____ _____ arr[0] = 90; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
