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:
- Show the contents of memory (including frame stack and heap).
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