<<< Array of Strings | Index | Array elements >>> |
An array of Product objects
Product[] products = new Product[5];
Code that uses a constant to specify the array length
final int TITLE_COUNT = 100; // size set at compile time String[] titles = new String[TITLE_COUNT];
Code that uses a variable to specify the array length
Scanner sc = new Scanner(System.in); int titleCount = sc.nextInt(); // size set at runtime String[] titles = new String[titleCount];
<<< Array of Strings | Index | Array elements >>> |