ycliper

Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
Скачать

Memory Allocation to Object and Methods Stack and Heap in Java || Lesson 34 || Java Programming ||

Автор: Wisdomers - Computer Science and Engineering

Загружено: 2023-06-27

Просмотров: 1365

Описание: Memory Allocation to Object and Methods Stack and Heap in Java
This class discusses Memory Allocation to Object and Methods Stack and Heap in Java.
The reader should have prior knowledge of the class and object. Click Here.
Random Access Memory:
The below diagram shows the random access memory organization we are using.
The RAM contains 8 bits in each line.
The line numbers are addressed from zero.
The Java virtual machine will allocate stack and heap space for execution.
We understand the stack and heap space allocation during execution.
Example:
The below diagram shows the example program.
The program is discussed in our previous class.
The class "firstExample" has one instance variable and two methods.
The class test has the main method.
The execution starts from the main method.
To execute the main method, we need some space.
The variables present in the main method need some space.
Before executing the main method, space is allocated in the stack for variables.
How much space is allocated for the main method?
The main method has an integer variable and an object variable.
Both variables need 8 bytes of space.
So eight lines are allocated to the main method in the stack.
The below diagram shows the stack space.
The memory location 2000 to 5000 is allocated for the stack.
The main method allocated space from 2000 to 2007.
In the main method, we create an object for the class "firstExample".
The class "firstExample" has one instance variable.
After creating an object, memory is allocated to the object.
The memory for the object is allocated in the heap.
The memory location 5001 to 5004 is allocated for an object ob.
The below diagram shows the heap space.
The next line of code calls the "add" method.
The add method is assigned space in the stack.
The add method has three variables a,b, and c.
So "add" method allocated 12 bytes of space to store the three variables in the stack.
The add method assigned space from 2008 to 2019 in the stack.
After completing add method, the space allocated for add will be removed.
That is the reason variables in the method are local.
The local variables can be used during the method execution.
After completion of method execution, local variables are no more.
Now the execution moves to the main method and calls the multiplication method.
The multiplication method contains three variables.
So the space from 2008 to 2019 was allocated to the multiplication method.
In the above way, memory is allocated for methods and objects in Java.

Link for playlists:
   / @wisdomerscse  


Link for our website: https://learningmonkey.in

Follow us on Facebook @   / learningmonkey  

Follow us on Instagram @   / learningmonkey1  

Follow us on Twitter @   / _learningmonkey  

Mail us @ [email protected]

Не удается загрузить Youtube-плеер. Проверьте блокировку Youtube в вашей сети.
Повторяем попытку...
Memory Allocation to Object and Methods   Stack and Heap in Java || Lesson 34 || Java Programming ||

Поделиться в:

Доступные форматы для скачивания:

Скачать видео

  • Информация по загрузке:

Скачать аудио

Похожие видео

Constructor in Java || Lesson 35 || Java Programming || Learning Monkey ||

Constructor in Java || Lesson 35 || Java Programming || Learning Monkey ||

ТЕГЕРАН: НА РАССТОЯНИИ УДАРА. БЕСЕДА С АНДРЕЕМ ПИОНТКОВСКИМ @Andrei_Piontkovsky

ТЕГЕРАН: НА РАССТОЯНИИ УДАРА. БЕСЕДА С АНДРЕЕМ ПИОНТКОВСКИМ @Andrei_Piontkovsky

🔥 O Level Practical Exam (M3-R5) | PR2 Python Programming 🔥Special Batch💯 Previous Year Based |

🔥 O Level Practical Exam (M3-R5) | PR2 Python Programming 🔥Special Batch💯 Previous Year Based |

Один с Дмитрием Быковым*. «Воскресение» Льва Толстого / 28.01.26

Один с Дмитрием Быковым*. «Воскресение» Льва Толстого / 28.01.26

Пожалуй, главное заблуждение об электричестве [Veritasium]

Пожалуй, главное заблуждение об электричестве [Veritasium]

Как Быстро ВЫУЧИТЬ Python в 2026 году

Как Быстро ВЫУЧИТЬ Python в 2026 году

Java Programming

Java Programming

Выходная головоломка Пошевели извилинами

Выходная головоломка Пошевели извилинами

Я удалил ';' из C

Я удалил ';' из C

Саботаж в правительстве Путина / Обыск во дворце

Саботаж в правительстве Путина / Обыск во дворце

Задача из вступительных Стэнфорда

Задача из вступительных Стэнфорда

Синто-фаги. Новый тип электромотора. Эффект Мигдала. Корова и инструменты. Новости QWERTY №365

Синто-фаги. Новый тип электромотора. Эффект Мигдала. Корова и инструменты. Новости QWERTY №365

Где начало СХЕМЫ? Понимаем, читаем, изучаем схемы. Понятное объяснение!

Где начало СХЕМЫ? Понимаем, читаем, изучаем схемы. Понятное объяснение!

Трансформатор - как работает и как устроен?

Трансформатор - как работает и как устроен?

21 неожиданный способ использовать Gemini в повседневной жизни

21 неожиданный способ использовать Gemini в повседневной жизни

Война с Европой — первым рискует Санкт-Петербург? Военный обзор Юрия Фёдорова

Война с Европой — первым рискует Санкт-Петербург? Военный обзор Юрия Фёдорова

Что происходит с нейросетью во время обучения?

Что происходит с нейросетью во время обучения?

⚡Всё! ТОТАЛЬНАЯ НИЩЕТА в РФ. Путин в УЖАСЕ! ДАЛЬШЕ – ХУЖЕ. Москву накрывает КАТАСТРОФА. ШИРЯЕВ

⚡Всё! ТОТАЛЬНАЯ НИЩЕТА в РФ. Путин в УЖАСЕ! ДАЛЬШЕ – ХУЖЕ. Москву накрывает КАТАСТРОФА. ШИРЯЕВ

✓ Триангуляция сферы. Математика для химии и геймдева | Математика вокруг нас | Борис Трушин

✓ Триангуляция сферы. Математика для химии и геймдева | Математика вокруг нас | Борис Трушин

Значительное повышение производительности Raspberry Pi 5 с AI Hat+2.

Значительное повышение производительности Raspberry Pi 5 с AI Hat+2.

© 2025 ycliper. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: [email protected]