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
Get info from website using javascript Project Description: I need to extract the text from all the available (red, blue) seats of all the events on this site without getting

Project Description: I am seeking someone to prepare a small Android app for a promotional offer. It must be designed for use on an Android tablet. Fundamentally, a user will

1. Pre-translated: Before the JSP file has been compiled and translated into the Servlet. 2. Translated: The JSP file has been compiled and translated as a Servlet. 3. I

What is difference between Design and System Architecture? System Architecture : It is structure of a product or procedure. Design: It is begin of the procedure of devel

Normal 0 false false false EN-IN X-NONE X-NONE

• A Graph Data Type (including a display method to show adjacencies) • A Cycle Checker (as described in lecture notes) • An Edge class • A sorting algorithm to sort an array of Edg


The fancy new French restaurant La Food is very popular for its authentic cuisine and high prices. This restaurant does not take reservations. To help improve the efficiency of the

Sudoku Class (Simple Version) The Sudoku class will encapsulate the minimum necessary data and logic to manipulate, print, and set the SudCells , in anticipation of a high

Describe synchronization in respect to multithreading. With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared res