top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is the difference between stack and heap in Java?

+1 vote
316 views
What is the difference between stack and heap in Java?
posted Apr 2, 2016 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Stack and heap memory are two terms programmers starts hearing once they started programming but without any clear and definite explanation. Lack of knowledge of what is a heap in Java and what is stack memory in Java results in misconceptions related to stack and heap. To add to this confusion, a stack is also a data structure which is used to store elements in LIFO(Last In First out) order and available in Java API as java.util.Stack. In general, both stack and heap are part of memory, a program is allocated and used for different purposes. Java program runs on JVM which is launched as a process by "java" command.

answer Apr 5, 2016 by Shubham Singh
...