Help to load a file into an array
- Because you don't know the size, you need to read until the end of the file (no longer has.next())
- Because you need to return the size of the array, the array to stored the data in must be passed.
- Because you need to pass the array, it needs to be instantiated before it is sent. It need not be initialized before you load because loading is initializing
- If there is more data than the maximum, you may
- let the error occur and the program fail
- handle the error in an appropriate manner. If you choose this option, discuss it in lessons learned
- A method may return a value (such as the number of items read), but that value need not be used.
This topic: CenterForComputing
> WebHome >
Syllabi >
CSC121SylF2023 >
CSC121F2023Lab09 > CSC121F2023Lab09Hint2
Topic revision: r2 - 2024-03-05 - CathyBareiss