Java dynamic memory allocation?

Why initialization of an object is used with a keyword newcalled dynamic memory allocation, since the compilation time itself we need to know the memory needed for this object.

Also explain what happens when you do ClassA object = new ClassA();on the heap and stack.

+5
source share
3 answers

All Java objects are dynamically allocated. You always pass links to them. So the language is designed. When you do:

ClassA obj = new ClassA();

, ( , , ). , , , .

+7

, , - .

, , , , . (, ).

+5

JMath ( ),

ArrayList<JMath> J = new ArrayList<JMath> ();
0

All Articles