7 Answers
New Answerto create an object of a class, we use this syntax. for example, we create a class Mobile. to create its objects, say htc and nokia, we write Mobile htc = new Mobile(); and Mobile nokia = new Mobile();
It will create a new object of class Animal and references it to a variable. Animal ani = new Animal(); ani is the reference variable here.
Here u r not storing the objects reference id in a reference variable, so it is called Anonymous object. It can be used once in a life cycle. After object is used once memory is freed.
it will create a new object of a class animal Animal ape=new Animal (); here ape is the reference variable
if u used malloc, function in C or new keyboard in C++ which is used to allocate memory for an object you'll understand what it does. and if u never heard about this function than let me clear, as u need to store data u need some memory , and memory is allocated by this 'new' keyword which allocated the memory according to its class definition. ( it check how space it's needs for data and for storing methods and than wrap up all the things together in memory block and return it's pointer to object. and we consider it as object as in Java)