I have only ever done the very basics in Java and really need help. I have to read innumbers from 1 to 20 and then print true if all the numbers are present and false otherwise. I don't know where to start!

Do you need to read the numbers from a file or from standard input?
if you need to read the numbers from standard input, you just need to have a loop where the numbers get entered into an array, then you would loop through them and test to see if one is different like this:

for(int i=0;i>=20;i++){
    if(numberArray[i] == (i+1){
        continue;
     }
     else {
         System.out.println("You did not enter all the correct numbers");
          break;
    }
}

you would do basically the same thing if they are read from a file

Your problem definition is a little unclear, but AceofSpades's code gives you a good base to start on. If you need more help, you need to show something you have written.

Make a boolean allNums = true;
1. Create an array of size 20.
2. Loop: Read the numbers in, and put them into the array
3. Loop: Check the array at each index. If the number isn't there for any index, set allNums to false.
4. If allNums is true, then print true, otherwise, print false.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.