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
how to retrieve multiple records randomly from a file and store it in another file

write a program in java using array and scanner class to generate padovan series

Write a code in java to explain the while loop in Java? // This is the Hello program in Java class Hello { public static void main (String args[]) { System.out.print("

Platform independence is the key feature of Java during runtime. Syntax of java is same to the popular object oriented languages such as C and C++. Java program can eliminate most

Explain Testing for Equality with equals? That's not what you expected. To contrast strings or any other kind of object you required to use the equals(Object o) techniques from

1. De normalizes your tables where required. 2. Proper use of index columns: An index based on numeric parts is more efficient than an index based on character columns. 3. Re

Want an Experienced iOS and Android expert Project Description: I am seeking a super talented team or Individual for a Real Estate app. The project wants to get done in a ver

How can you define a consistent web design? Why is it needed? A consistent web design should be the one in which achieves the result in which it was designed for, which result

Given the following XHTML page:   Create an embedded JavaScript function named getUserInfo that prompts the user with the following two questions after the XHTML page has loa

Video course on computer security needed Project Description: We want a video course on computer security. Just like the way lynda provides. Skills required are Computer S