java - How to use ArrayList while adding something to another Class's constructor ? -
i'm try create 1 simple reservation system, we'll read file, we'll add train, bus, etc., we'll writer output. import java.io.*; import java.util.*; public class company { private static arraylist<bus> bus = new arraylist<bus>(); static int buscount = 0, traincount = 0; public static void main (string[] args) throws ioexception { fileparser(); } public company() { } public static void fileparser() { try { file file = new file(); //i fill later file file2 = new file(); // fill later fileinputstream fis = new fileinputstream(file); fileoutputstream fos = new fileoutputstream(file2); bufferedreader br = new bufferedreader(new inputstreamreader(fis)); bufferedwriter bw = new bufferedwriter(new outputstreamwriter(fos)); string line; while ((line = br.readline()) != null) { string[] splitted = line.split(","); if(spli...