Question: Need a full explanation thanks 7. The Rational class example covered during the course has 2 instance variables of type int corresponding to the numerator

Need a full explanation thanks
7. The Rational class example covered during the course has 2 instance variables of type int corresponding to the numerator and denominator respectively. Consider the following: public void run() { Rational a = new Rational(1,6); Rational b = new Rational (2,6); Rational c = new Rational(1,3); Rational d = new Rational(1,6); Rational sum = a.add(b).add(c).add(d); Exam Version 1 - October 19, 2018 Name: Student ID: Assuming the overhead of representing an object in memory is negligible, how many bytes of memory are allocated on the heap and stack respectively on execution of the last statement in run()? You may assume that object references require 4 bytes. a. 56,20 b. 56,16 c. 40,20 d. 48,16 e. 40,16 Answer: 7. The Rational class example covered during the course has 2 instance variables of type int corresponding to the numerator and denominator respectively. Consider the following: public void run() { Rational a = new Rational(1,6); Rational b = new Rational (2,6); Rational c = new Rational(1,3); Rational d = new Rational(1,6); Rational sum = a.add(b).add(c).add(d); Exam Version 1 - October 19, 2018 Name: Student ID: Assuming the overhead of representing an object in memory is negligible, how many bytes of memory are allocated on the heap and stack respectively on execution of the last statement in run()? You may assume that object references require 4 bytes. a. 56,20 b. 56,16 c. 40,20 d. 48,16 e. 40,16
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
