Skip to content
Advertisement

Tag: arrays

Swapping elements in an array Java

I am working on a classes challenge in school. We have to great a Boat class and Harbor class. I have gotten every test to work except the final test of where boats are parked in the Harbor. The Harbor constructor contains an array for the Harbor. The test we have to run is below and the code I have

traverse an array in GUI Java

I am doing a questionnaire with questions and written answers. I need that when adding the answer, press the main button, tell me if it is correct or not and show me the other question of the array, until the array is finished. Here I upload the whole code. Answer You have the right idea, but you need to process

Read a text file to create a 2D Array in Java

I have a text file with first line will be the size of the board and the remaining values will be the values of p row by row. All values are separated by whitespace. For example: 5 2 5 10 3 5 4 6 9 12 3 11 5 9 7 7 7 2 4 8 19 2 6 8

How to auto create arrays

Hello! So there’s a problem. We’re given a file.txt with a lot of numbers (let’s consider the amount is greater than 1000). On the first line we can see the amount of numbers. The next lines contain numbers (1 line = 1 number). So we need to write a code which will autofill arrays with all these numbers. We’re not

Advertisement