+ 5
Does constructor creates an object or not?
7 Antworten
+ 5
No, constructors initializes the class' members value, they are used to "prepare" the class for use by setting up the members to a predefined set of value, or custom value that could be passed through the constructor method's parameters.
Hth, cmiiw
+ 3
yup
+ 2
Yes that is his job
+ 1
than what is the job of new keyword
+ 1
I like turtles
+ 1
Ankur Singh ...The 'new' keyword is used to create an instance of a class or array object. Using keyword for this end is not completely necessary, though it serves two purposes: it enables the existence of different namespace for methods and class names, it defines statically and locally that a fresh object is indeed created, and of what runtime type it is.
0
no by giving "new" operator we are just creating the new area in the heap area to store all non static methods from object class as well as class to which the constructor is created .