How to allocate memory dynamically

In C we do that my malloc how to do that in java

In java you don’t have to do that memory is allocated at the run time by the compiler