Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

Java and heap

Rating
-
Sold
-
Pages
2
Uploaded on
10-05-2023
Written in
2022/2023

Lecture notes of 2 pages for the course BSA at BSA (Easy to understand)

Institution
Course

Content preview

#26 Stack And Heap in Java
Telusko


JVM Memory Structure

Let's take a look at the memory structure of the JVM.
Firstly, we have the stack memory, which stores data in
a last-in-first-out sequence. Secondly, we have the
heap memory, which has an open space to store data
in.

Local vs Instance Variables

There are two types of variables: local and instance.
Local variables are declared within a method, whereas
instance variables are declared within a class. In the
example of a calculator, the variables n1 and n2 are
local, and num is an instance variable.

Function Calling and Data Areas

When a function is called, it creates a new stack in
memory. The add method has its own stack with n1 and
n2 variables, and num is not a part of either the add or
main stack. The heap memory is used to store the
reference variable obj.

Written for

Course

Document information

Uploaded on
May 10, 2023
Number of pages
2
Written in
2022/2023
Type
Class notes
Professor(s)
Telusko
Contains
All classes

Subjects

$8.49
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
ymenkudle

Get to know the seller

Seller avatar
ymenkudle ILS
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
2 year
Number of followers
0
Documents
1
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions