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
Consider the following code? What input is needed for x in order for the sum variable that is output at the end of the code to be 12 ? (In other words: what do I need to make X be


When is AlreadyBoundException thrown and by which method? Ans) AlreadyBoundException is thrown by bind(String name) method when a remote object is already registered with the re

Describe Invoking Methods in java? class Car { String licensePlate = ""; // e.g. "New York 543 A23" double speed = 0.0; // in kilometers per hour double maxS

Comparable interface: The "Comparable" allows itself to compare with other same types of object. The function compareTo() is specified in the interface. Several of the standa

palindrome is starting that reads both the ends.using string covert into character

Describe the Four Levels of Access Protection ? Any two various Java objects have one of four relations to each other. The four relations are: • The objects are in the simila

What are the different messaging paradigms JMS supports? Ans) Publish and Subscribe i.e. pub/suc and Point to Point i.e. p2p.

how can i add script code in anouncement of a channel in a massneger the massnegr suport that but do not published it please help me please:((((((((((((((((((((((((((((((((((((((((

A Padovan string P(n) for a natural number n is defined as: P(0)=''X'' P(1)=''Y'' P(2)=''Z'' for a string characters ''X'',''Y'',''Z'' only,and given value of n,write a program th