arun prasad

arun prasad

  • NA
  • 1
  • 0

what happens when we create an object

Apr 27 2010 1:48 AM
Hello everyone,
                          I know what happens when we give a syntax like,

                     class_name obj = new class_name();
      
            The above statement will create an instance with the name obj for the class named class_name.  Here the constructor of the class will be automatically called and it will return the total number of space required for that instance and that much space will be created by new operator. 

But what happens when i give like,

                    int x = new int();

and also, what is the difference between the above one and

                   int x = 10;



Answers (4)