public class BicycleInventory
{
private static Bicycle [] b;
public BicycleInventory()
{
b = new Bicycle[25];
}
public static void readInventory()
{
int index = 0;
try
{
File f = new File("bicycle.txt");
Scanner file = new Scanner(f);
while (file.hasNextLine())
{
String[] line = file.nextLine().split(",");
String type = line[0]; int wheelSize = Integer.parseInt(line[1]);
boolean assembled = Boolean.parseBoolean(line[2]);
char gender = line[3].charAt(0);
b[index] = new Bicycle(type, wheelSize, assembled, gender);
index++;
}////catch...blahblahblah
#How do I create an array of objects? Cannot store to object array because b is null. Thanks
1 messages · Page 1 of 1 (latest)