I am starting to learn java (from sean greasly), and I encountered a problem in this script. Can anyone show me how to fix it?
Code:package helloworld; import java.util.*; /** * * @author Kevin */ public class Arrays { public static void main(String[] args) { int[] studentAge = new int[5]; Scanner theInput = new Scanner(System.in); for (int x = 0; x < studentAge.length; x++) { System.out.print("Enter age for student " + (x + 1) + ": "); studentAge[x] = theInput.nextInt(); } System.out.println("The student ages are: "); for (int x = 0; x < studentAge.length; x++) { if (x == studentAge.length) { System.out.println(studentAge); } else { System.out.print(studentAge + ","); } } theInput.close(); } }




), and I encountered a problem in this script. Can anyone show me how to fix it?
Reply With Quote

















