Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA - Create a public static integer field named nextAddress and initialize nextAddress with 4 0 0 . Ex: If the input is 3 0

JAVA
-
Create a public static integer field named nextAddress and initialize nextAddress with 400.
Ex: If the input is 30, then the output is:
Next available address is 400.
Memory location has 30 elements and the elements are assigned with addresses from 400 to 519.
Next available address is 520.
public class MemoryLocation {
/* Your code goes here */
private int size;
private int startAddress;
private int endAddress;
public MemoryLocation(int newSize){
size = newSize;
startAddress = nextAddress;
endAddress = startAddress + size *4-1;
nextAddress += size *4;
}
public void print(){
System.out.print("Memory location has "+ size);
System.out.print(" elements and the elements are assigned with addresses from "+ startAddress);
System.out.println(" to "+ endAddress +".");
}
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions

Question

What is the meaning and definition of E-Business?

Answered: 1 week ago