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
qtp 9.2 14 days demo version was expired.I uninstalled how to reinstall this again
what is woransient key word? how it is used in java
why we use abstract word in abstract window toolkit in java language.
9.Difference between even and odd signals?explain with the diagram?
how to add Servlet-api.jar file into eclipse 3.3.2 ?
In mainframe SDSF, Can we copy the list of jobs currently executing in SDSF in to a seperate DATASET...?
Write a program to find whether a given number is prime or not.
In project we have Documentation phase also,in that what is micro and macro designing?
Plz sent me in .net 2.0 interview Question & answers?
in IT trend mantis meant what? how to know mantis in IT trends? detail description about mantis?
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?
What is the difference beween joblib and steplib statements
Explain polymorphism. Provide an example.
i want to insert textbox value to sql db. i have only one text box but store four values. ple give any one give sample code in asp.net c#..
THE CHANNEL IN DATA COMMUNICATION CAN BE?