Constructors or destructors in java program, JAVA Programming

Assignment Help:

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.


Related Discussions:- Constructors or destructors in java program

Encapsulation, Defines to keeping all the related members together in an ob...

Defines to keeping all the related members together in an object. Specifying member variables as private may hide the methods and variables. Objects should hide their inner working

How the jms is different from rpc, In RPC the method invoker waits for the ...

In RPC the method invoker waits for the method to finish implementation and return the control back to the invoker. Therefore it is completely synchronous in nature. Whereas in JMS

What is meant by universal access of internet services, What is meant by un...

What is meant by universal access of internet services ? the meaning of Universal access of internet services means same functionality to everyone.

Socket programming in Java: TCP, Objectives: socket programming in Java: TC...

Objectives: socket programming in Java: TCP Exercises: Goal: In this project we will develop a Web server in two steps. In the end, you will have built a multi-threaded Web ser

Conditional Operators, I need a chart and how this works with java? The fun...

I need a chart and how this works with java? The functions itself.

Difference between boolean & operator and && operator, How can we define th...

How can we define the difference between the Boolean & operator and the && operator ?

Series, Write a Java program to find the sum of 1+3+5+…. , for 10 terms in ...

Write a Java program to find the sum of 1+3+5+…. , for 10 terms in the series.

What are adding methods, What are adding methods? A subclass isn't rest...

What are adding methods? A subclass isn't restricted to changing the behavior of its superclass. It can also add fully latest techniques and fields that are not shared along wi

Java application for create-read-update in table, You are required to imple...

You are required to implement a Java application that allows a user to create, read, update and delete data in a table in a MySQL database. Your program must use a Java class that

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd