TutorMe homepage
Subjects
PRICING
COURSES
SIGN IN
Start Free Trial
Anissa A.
Tutor for 2 1/2 Years
Tutor Satisfaction Guarantee
Java Programming
TutorMe
Question:

Why is there no concept of a destructor in Java?

Anissa A.
Answer:

The difference is that Java objects are heap allocated and garbage collected. Java has a built in garbage collector the cleans up unreachable objects. This helps prevents Java programs from running out of memory, by routinely clear up space in the heap. However since there is no guarantee that an object will ever become unreachable, it would not be reasonable to create a destructor. The garbage collectors automatic deletion suffices.

Computer Science (General)
TutorMe
Question:

What are composition and aggregation and how do they differ?

Anissa A.
Answer:

Composition and aggregation are both associations. An object that has a composition relationship to another object, if it is related to that other object, but also doesn't have meaning alone. The first object doe not make sense as a standalone item. An example would be an engine of a car. The engine is apart of the car, but has little value alone. An object has an aggregation relationship to another object, if it is related to an object, but can be used independently. An example would be an employee and a company. An employee can work for a company, but can work for several companies.

C++ Programming
TutorMe
Question:

Why are the lengths of single dimensional arrays often passed with the arrays? For example, sort(int arr[], int length) is a user function that sorts arrays. Why is the length passed versus calling length on the array arr?

Anissa A.
Answer:

The answer relates back to the pointers and what it means to pass an array in C++. When you are passing an array in C++, you are not passing the whole block of memory. You are only passing a pointer to the first element in the array. This means that the information regarding the length of the array is no longer available via length. In order to ensure that the correct length is used for the array, it is often passed as an argument.

Send a message explaining your
needs and Anissa will reply soon.
Contact Anissa
Ready now? Request a lesson.
Start Session
FAQs
What is a lesson?
A lesson is virtual lesson space on our platform where you and a tutor can communicate. You'll have the option to communicate using video/audio as well as text chat. You can also upload documents, edit papers in real time and use our cutting-edge virtual whiteboard.
How do I begin a lesson?
If the tutor is currently online, you can click the "Start Session" button above. If they are offline, you can always send them a message to schedule a lesson.
Who are TutorMe tutors?
Many of our tutors are current college students or recent graduates of top-tier universities like MIT, Harvard and USC. TutorMe has thousands of top-quality tutors available to work with you.