Answer Posted / shrikant kale
I think the answer to this is very interesting.
For one, I believe that in Java all objects are on the
heap, and while you don't have pointers, you do
have "References". References have copy symantics and java
internally keeps track of reference counts so that it's
garbage collector knows whats safe to get rid of.
Since you only access objects through copyable references,
the actual number of times you need to copy an object is
greatly reduced (for example, in C++ just passing an object
to a function (by value) results in new objects being copy
constructed, in Java only the reference to the object is
passed). The designers probably figured that clone() would
be enough for the remaining uses.
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Does dev c++ support c++ 11?
Mention the ways in which parameterized can be invoked. Give an example of each.
Explain the static storage classes in c++.
What are arithmetic operators?
What is encapsulation in simple terms?
Mention the purpose of istream class?
How do you answer polymorphism?
What does flush do c++?
How can you quickly find the number of elements stored in a dynamic array? Why is it difficult to store linked list in an array?
Does c++ have arraylist?
Assume studentNames and studentIDs are two parallel arrays of size N that hold student data. Write a pseudocode algorithm that sorts studentIDs array in ascending ID number order such that the two arrays remain parallel.
What is pointer with example?
Can we distribute function templates and class templates in object libraries?
What are the two types of comments?
How does a copy constructor differs from an overloaded assignment operator?