We use static functions for this. This means that there are two ways of memory allocation for the elements of any JAVA program. The first category is static memory allocation (preemptive memory allocation) and the second category is dynamic memory allocation (memory allocation at execution). In static allocation, the memory is allocated to the method after compilation and we don't have to create an object for it to assign memory through an instance.
For example,
public static int stmemalloc()