subject
Computers and Technology, 21.05.2021 01:00 giovney

A BoundedintArray represents an indexed list of integers. In a BoundedIntArray the user can specify a size, in which case the indices range from 0 to size - 1. The user can also specify the lowest index, low, in which case the indices can range from low to low + size - 1. public class BoundedIntArray

{

private int[] myItems; // storage for the list

private int myLowIndex; // lowest index

public BoundedIntArray(int size)

{

myItems = new int[size];

myLowIndex = 0;

}

public BoundedIntArray(int size, int low)

{

myItems = new int[size];

myLowIndex = low;

}

// other methods not shown

}

Which of the following is the best reason for declaring the data fields myItems and myLowIndex to be private rather than public?

This permits BoundedIntArray objects to be initialized and modified.
Answer A: This permits, BoundedIntArray , objects to be initialized and modified.

Answer B: This permits, BoundedIntArray , methods to be written and tested before code that uses a, , BoundedIntArray , is written.

Answer C: , This helps to prevent clients of the, BoundedIntArray , class from writing code that would need to be modified if the implementation of , BoundedIntArray , were changed.,

Answer D: This prevents compile-time errors whenever public methods are called that access the private data fields.

.
Answer E: This prevents run-time errors whenever public methods are called that access the private data fields.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 06:00
Write a program that uses a widgetviewer object to do the following: generate two random integers between 1 and 9 (inclusive). name one of them x, the other y. display them to the user using jlabel objects. create a jlabel object displaying the text "enter an operation number." create a jtextfield for the user's input. create a jbutton displaying the text "press here when you've entered your operation." use addandwait to add it to the widgetviewer object. when the user clicks the jbutton, evaluate operation in the following order to determine the one and only mathematical operation to perform on x and y. use a jlabel to display the result. if operation is between 1 and 10 inclusive, add x and y. if operation is evenly divisible by 4, subtract y from x. if operation is evenly divisible by 5, use integer division to divide y into x. if operation is an even number, use floating point division to divide y into x. if none of the other tests on operation apply, multiply x and y. note: operation can be negative or zero.
Answers: 2
question
Computers and Technology, 22.06.2019 07:30
What type of computer network ensures high security ?
Answers: 1
question
Computers and Technology, 22.06.2019 18:30
Technician a says that a shop towel should never be used to clean around the flange area before replacing an automatic transmission filter. technician b says that a dimpled transmission fluid pan can be repaired. who is right
Answers: 3
question
Computers and Technology, 23.06.2019 04:31
Q14 what is most important for you to choose before you build a network? a. private network b. nos c. network media d. network protocol e. directory service
Answers: 1
You know the right answer?
A BoundedintArray represents an indexed list of integers. In a BoundedIntArray the user can specify...
Questions
Questions on the website: 13722361