I'm very new to programming, and I would greatly appreciate some help with this. The following code is supposed to count how many numbers are in a specified range, 4 to 17, in the array.
The code I have written (which could be totally off for all I know) is right here:
import java.io.*; public class NumberInRange { public static void main(String[] args) { int list[] = {14, 1, 22, 17, 36, 7, -43, 5}; int min = 4; int max = 17; int count = 0; countInRange(); } public static int countInRange (int [] list) { for (int i = 0; int i < list.length; i++) { if (list[i] >= min && list[i] <= max) { count++; } } return count; } }
Any help would be greatly appreciated! I do not know what the errors mean, but here are what the four errors say:
NumberInRange.java:19: '.class' expected
for (int i = 0; int i < list.length; i++) {
^
NumberInRange.java:19: > expected
for (int i = 0; int i < list.length; i++) {
^
NumberInRange.java:19: ')' expected
for (int i = 0; int i < list.length; i++) {
^
NumberInRange.java:19: illegal start of expression
for (int i = 0; int i < list.length; i++) {
^