In java , two kinds of memories are used namely stack and heap memory.
Stack memory is used to store function calls and the local variables defined within the function.