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
State the Verify phase of Java Program Development Before the bytecodes in an application are executed by the java interpreter, they are verified by the bytecode verifier in

Why are JSP pages the preferred API for creating a web-based client program? Because no plug-ins or security policy files are required on the client systems (applet does). Also,

Talent agencies like ICM, CAA and Paradigm represent writers, directors and actors (among other talent).  These agencies take in hundreds of millions of dollars a year collecting 1

Preventing Applet Based Social Engineering Attacks To help avoid this, Java applet windows are specifically labeled as such along with an ugly bar that says: "Warning: Applet W

What Is a Socket in Java Networking and RMI? Ans) A socket is one end-point of a two-way communication link among two programs running on the network. A socket is bound to a por

(Tic-Tac-Toe)  Create class TicTacToe that will enable you to write a complete application to play the game of Tic-Tac-Toe. The class contains a private 3-by-3 rectangular array o

#include float start_point, /* GLOBAL VARIABLES */ end_point, total_area; int numtraps; main( ) { void input( void );

In this assignment, you will create 5 objects and get them to interact together. You will create theatres for which patrons will buy tickets from a box office to watch movies.

This work assesses the following Outcomes: • Build robust, secure distributed systems using advanced programming techniques Use RMI to build a distributed application accessing

What is asynchronous messaging? Queue Ans) Asynchronous messaging includes a client that does not wait for a message from the server. An event is used to trigger a message from