Question: Consider the following code of a class. public partial class StuffDriver : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void btnStuffDriver_Click(object

Consider the following code of a class.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="StuffDriver.aspx.cs" Inherits="StuffDriver.StuffDriver" %>

public partial class StuffDriver : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

}

protected void btnStuffDriver_Click(object sender, EventArgs e)

{

stuff st = new stuff("alpha", 4);

stuff.abc[0] = new stuff("beta", 3);

stuff.abc[2] = new stuff();

}

}

public class stuff

{

private int xyz;

private String xxx;

private static int yyy = 4;

public static stuff[] abc = new stuff[3];

public stuff()

{

setXXX("Omega");

setXYZ(abc.Length);

}

public stuff(String n, int i)

{

setXXX(n);

setXYZ(i);

}

public String Method1(int x)

{

String a = xxx.Substring(0, x + 1);

return a.ToUpper();

yyy = yyy + xyz;

}

public static String method2()

{

int z = 0;

String temp = "";

for (int i = 0; i < abc.Length; i++)

if (abc[i] != null)

{

temp = abc[i].Method1(i);

z += abc[i].getXYZ();

}

return temp + " z: " + z;

}

public void setXXX(String xxx)

{ this.xxx = xxx;

}

public String getXXX()

{ return xxx;

}

public void setXYZ(int xyz)

{ this.xyz = xyz;

}

public int getXYZ()

{ return xyz;

}

}

Based on the above code, do the following:

  1. Show the contents of memory (including frame stack and heap).

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!