+ 4
Why there are no malloc and calloc functions in java or in any other language except c ?
Please provide an example with answer
3 ответов
+ 8
languages without automatic garbage collection like c and c++ have those functions to enable the user to work with memory
higher level languages like java don't need those functions as they do have automatic garbage collection
+ 8
In java ,new keyword used instead of malloc, and garbage collector instead of free.
As Java manages memory for you(user) one cannot explicitly delete or free up memory instead You can explicitly set an object variable to null!
+ 2
Thank you for the answer Ashish Jog & hinanawi 😃👍