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
Why hub is used in networks? Hub is networking equipment and a device that connects various computers to form a network. In a network the NIC translates the message within elec

I just finished a small tutorial on JSP and servlet now I was looking for some assignments so that I can try my hands on

The software or script to scan automotive ads Project Description: Looking for a company that made the script or application to search through pages of listings of automotive

Introduction As an alternative to the Binary Search algorithm, also it could be done by the brute-force method given below. public static int rank(int key, int[] a) {     f

Plug-in for Adobe after Effects Project Description: We are seeking software engineers to create a plug-in for Adobe after Effects (CS4 and above) that allows 3D extrusions f



What is the difference between method overriding and overloading? Overriding is a method with the same name and arguments as in a parent, whereas overloading is the same met

Number = new Array(5); var abc=4; for(var i=1; i { Number[i]= abc*i; } Number.reverse(); for(j=0;j { document.write(" "+Number[j]+" "); } A) What should be output of above co

10.13 (CarbonFootprint Interface: Polymorphism) Using interfaces, as you learned in this chapter, you can specify similar behaviors for possibly disparate classes. Governments and