Java – Abstraction of arrays?

Abstraction of arrays?… here is a solution to the problem.

Abstraction of arrays?

This is an assignment where one of the tasks is to create an abstraction of the array, does that mean I’m declaring an abstract array here, and if so, how would I declare it

private abstract Array<TYPE> Disk = new Array<TYPE>()

Something like that?
It is still impossible to create an abstract array, and it talks about abstracting the class and inserting an array into that class

Build an abstraction of an array of integers on disk. If the file exists,
* It should be opened and its length calculated (size parameters ignored).
* If the file does not exist, it should be created and the size is zero
* Write to a file.
^^
The goal is here

Please don’t answer or give me any code other than yes or no declaring that array and if it works

Solution

The given input is a bit sparse, so I can only guess what to do.

Abstraction can be interpreted in a variety of ways.

  • “Creating an abstract array” is not building an abstraction. Abstract methods are often used to indicate that the method is not implemented. In this case, I don’t think it makes any sense.
  • Same as creating an abstract class.

Or, as I said:

  • You have to abstract something, which means you hide details and/or information. In your case, you have an array of integers and you want to store it on disk. In addition, you have some actions to apply to this. This gives you an abstraction. You define an interface (operation) and hide all the rest (an array of integers, stored on disk). In other words, you abstract all the details and offer some easy-to-use interfaces.

So it seems to me that you have to create a class with the required operations and implement some store/load methods, and return the appropriate result.

Related Problems and Solutions