Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Answer the following questions: - ArrayStack is a public class. What does this mean in terms of the overall visibility of the class? Why is

image text in transcribed

Answer the following questions:

- ArrayStack is a public class. What does this mean in terms of the overall visibility of the class? Why is this a good design decision? [2]

- All class variables are of type protected. What does this mean in terms of their overall visibility? [1]

- ArrayStack stores objects of type Object rather than specific types like int or float. Why is this good idea? How is this design decision linked to the concept of an explicit cast as a means to store and retrieve any kind of object types on such a stack? [3]

public class ArrayStack implements Stack actual capacity of the stack array protected int capacity; protected static final int CAPACITY protected Object S: protected int top =-1; 1000;// default array capacity II array used to implement the stack II index for the top of the stack public ArrayStacko II default constructor: creates stack with default capacity this(CAPACITY); public void push(Object element) f if (isFullO) return; top++ S[top]- element

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_2

Step: 3

blur-text-image_3

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

Concepts of Database Management

Authors: Philip J. Pratt, Mary Z. Last

8th edition

1285427106, 978-1285427102

More Books

Students also viewed these Databases questions