Constructors or destructors in java program, JAVA Programming

Consider the following Java definition of an integer list class.
class IntegerList
{
private int[] list = new int[200];
private int size = 0;
public boolean append(int value)
{
if (size == list.length)
return false;
list[size++] = value;
return true;
}
public String toString()
{
String result = "";
for (int i = 0; i < size; i++)
result += list[i] + " ";
return result;
}
}

Suppose this class was rewritten in C++ in two ways, the first with the array that represents the list as a stack-dynamic variable, and then with the list as a heap dynamic variable. Explain when constructors and destructors would be needed. Explain why no constructors or destructors are needed in the Java implementation.

Posted Date: 4/6/2013 5:47:12 AM | Location : United States







Related Discussions:- Constructors or destructors in java program, Assignment Help, Ask Question on Constructors or destructors in java program, Get Answer, Expert's Help, Constructors or destructors in java program Discussions

Write discussion on Constructors or destructors in java program
Your posts are moderated
Related Questions
Explain Code and Document Bases ? If you don't know the exact URL of the image, but you do know its name and in which it's in the similar directory as the applet, you can use

I can''t figure out how to do this question: "Given two linear equations: ax + by + c = 0 and dx + ey + f = 0" solve for x and y. A, b, c, d, e, and f being inputted from the user.

I want Hall Rental Website Project Description: I want to prepare website for my party venue where i will post the photos and detail of place along with availability calendar

Cryonic Labs Project Description: Seeking people to collaborate with in designing gaming apps and mobile apps for the Android Market. I'm presently a student in Computer Engi

To use the DispatchAction, follow these steps: ? Make a class that extends DispatchAction (instead of Action) ? In a new class, add a method for each function you need to per

Mine craft plug-in Coder Project Description: Some custom plugging for my Mine craft server. Skills required: Java, Editing

How do I prevent the output of my JSP or Servlet pages from being cached by the browser? Ans) You will require to set the appropriate HTTP header attributes to stop the dynamic

Explain what is Local Variable ? Declaring variables (using the var keyword) inside a function forms them local. They are available only inside the function and hold no meaning

Why Local variable is preferred over Global variable ? In my point of view Global variable has a few advantage along with Local variables is preferred because of the subsequent

What is a Relational Database? Give the names of any three RDBMS software? Database consist of two or more then two tables are called Relational database. Oracle dabatbase S