Why we need new operator in java at the time of object
declaration and why not in c++?
Answer Posted / anuja joshi
The major difference between Java and C++ is the behavior of object variables. In C++, object variables hold values, not object references. Note that the new operator is never used when constructing objects in C++. You simply supply the construction parameters after the variable name.
Point p(1, 2); /* construct p */
If you do not supply construction parameters, then the object is constructed with the default constructor.
Time now; /* construct now with Time::Time() */
This is very different from Java. In Java, this command would merely create an uninitialized reference. In C++, it constructs an actual object.
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
what is the extension of SPDS Dynamic cluster tables?
what is log files in qtp what is use
Diff between IF and where ?
what is difference between kpo and it industry? that is in terms of work, package etc
why not instantiating servet using new operator?
Given a Binary Search Tree, write a program to print the kth smallest element without using any static/global variable. You can?t pass the value k to any function also.
Hi All, Can any one please send me the difference between informatica 7i and 8i versions, Thanks in advance. vinod
what is the basic and unique feature of dotnet
I HAVE DONE TESTING TOOLS COURSE,NOW I AM FRESHER,I AM NOT GETTING ANY CALLS,I WANT TO DO THE PROJECT ,WHERE I HAVE TO MEET TO DO THE PROJECT,I AM GOING WITH FAKE EXPERIENCE,SO WHAT I HAVE TO DO.
what are the missinschema properties and should we pass primary key in select command
Bonjour, svp je veut voir comment envoyer un mail en java et comment changer le droit d'accé d'un fichier en java: de lecture en lecture/écriture et merci d'avance ;)
Explain polymorphism. Provide an example.
Hai, My name is nisha.I have NIC exam.If anybody Knows NIC previous paper pattern pls send me to nishanairp@gmail.com
what is session state?
1. How many jobs can we write in a single file? 2. How many maximum members can exist in a single partition data set(pds) in jcl?