I need to print this array without having he last array item print with a comma. I have tried setting i to be less than 3 but it will not work. :/ I cannot get this last array entry to print all by itself. This is homework so please do not feel the need to give me the answer just a nudge in the right direction would help!
import java.util.Scanner;
public class PrintWithComma {
public static void main (String [] args) {
final int NUM_VALS = 4;
int[] hourlyTemp = new int[NUM_VALS];
int i = 0;
hourlyTemp[0] = 90;
hourlyTemp[1] = 92;
hourlyTemp[2] = 94;
hourlyTemp[3] = 95;
for(i = 0; i < NUM_VALS; i++){
if(hourlyTemp[i] < NUM_VALS);
System.out.print(hourlyTemp[i]);
}
System.out.println("");
return;
}
}