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

Extensible messaging and presence protocol, According to XMPP Standards Fou...

According to XMPP Standards Foundation "XMPP is the Extensible Messaging and Presence Protocol, a set of open technologies for instant messaging, presence, multi-party chat, voice

Write a program to find the area under the curve y = f(x) in, #question.Wri...

#question.Write a program to find the area under the curve y = f(x) in java.

Concurrent Programming, Problem 1 A savings account object holds a non-nega...

Problem 1 A savings account object holds a non-negative balance, and provides deposit(k ) and withdraw(k ) methods, where deposit(k ) adds k to the balance, and withdraw(k ) subtra

What are wrapper classes, What are wrapper classes? Java gives speciali...

What are wrapper classes? Java gives specialized classes corresponding to every of the primitive data types. These are known as wrapper classes. They are example: Integer, C

What does wan stand for, What does WAN stand for? Wide Area Network - A...

What does WAN stand for? Wide Area Network - A network in that computers are separated through great distances classically across cities or even continents.

Develop an ehospital project, Develop an ehospital project Project Descr...

Develop an ehospital project Project Description: I am preparing ehopsital project.for the requires of hospital in that patient registration and billing module and stores mod

Complete back end and front end development, Complete Back end and Front En...

Complete Back end and Front End Development Project Description: This work is a part of ongoing project. The need is to prepare and integrate the web part of this project.

Explain what is multilevel inheritance, Explain what is Multilevel Inherita...

Explain what is Multilevel Inheritance ? The Car-Motorcycle-MotorVehicle instances showed single-level inheritance. There's nothing to stop you from going next. You can describ

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