+ 2
Can we instantiate with out using new operator ,if yes than how?
3 ответов
+ 3
Only when you use the "new" keyword, an object is instantiated and the memory is allocated in the heap.
But for successive object creation you can assign the previous object to a new reference variable.
Edit: String class is an exception.
+ 2
Using java reflection:
https://code.sololearn.com/c3X2D7A2ct3L/?ref=app
0
Object obj=obj2;
Here obj2 is another object...
Using up casting, down casting is an examples..
And both objects points to same references in heap.