Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A class called Movie is defined like below: An object of this class is created like below: Your job is to fill in the two

A class called Movie is defined like below:

image text in transcribed

An object of this class is created like below:

image text in transcribed

Your job is to fill in the two columns of the two tables below for the code above, when an object of Movie is created. The first table represent the program stack and the second represents the garbage collectible heap. The first column of the table represents memory address and the second, represents memory content . Please note that based on the given base memory address, you are required to determine what will be the next memory address.

For this question, you can assume that an object reference requires 4 bytes of memory.

image text in transcribed

class Movie double rating; int yearReleased; int lengthInMinute; String name; public Movie (double r, String n, int y, int 1) { rating = r; yearReleased = y; lengthInMinute = 1; name = n; } } double rating = 8.7; String name = "The Crown"; int yearReleased = 2016; int lengthInMinute = Integer.MAX_VALUE; // MAX_VALUE = 2147483647 Movie crown = new Movie(rating, name, yearReleased, lengthInMinute); Program Stack Memory Address Memory Content 100 Garbage Collectible Heap Memory Address Memory Content "The Crown 500 518 class Movie double rating; int yearReleased; int lengthInMinute; String name; public Movie (double r, String n, int y, int 1) { rating = r; yearReleased = y; lengthInMinute = 1; name = n; } } double rating = 8.7; String name = "The Crown"; int yearReleased = 2016; int lengthInMinute = Integer.MAX_VALUE; // MAX_VALUE = 2147483647 Movie crown = new Movie(rating, name, yearReleased, lengthInMinute); Program Stack Memory Address Memory Content 100 Garbage Collectible Heap Memory Address Memory Content "The Crown 500 518

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions