I have now a csv file called MyUniversityCourses.csv , and I hope to read each line into an ArrayList of objects. No bugs or errors during running. In java. please help.
This is the csv File.
This is the Course Class.
This is the part of code of me trying to deserialization.
Course_Name, Course_Id, Maximum_Students, Current_Students,List_of_Names, Course Instructor,Course_Section_Number, Course_Location PAC II,csCI-GA.1144,7,0,NULL,Mohamed Zahran, 1,CIWW 312 Fundamental Algorithms, CSCI-GA.1170,4,0, NULL,Joel Spencer, 1,CIww 109 Programming Languages, CSCI-GA. 2110,7,0, NULL, Benjamin Goldberg, 1,CIWW 109 Compiler Construction , CSCI-GA. 2130, 3,0, NULL , Eva Rose, 1.c1w 202 Open Source Tools,cSCI-GA.2246,7,0,NULL,Jeffrey Korn,1,60 Fifth Ave c12 Operating Systems, CSCI-GA.2250,5,0,NULL, Hubertus Franke,1,CIWw 109 Database Systems, CSCI-GA.2433,4,0,NULL, Zvi Kedem,1,CIWW 101 Software Engineering,CSCI-GA.2440,7,0,NULL,Jean Claude Franchitti,1,CIWW 312 Web Search Engines,CSCI-GA.2580,6,0,NULL,Ernest Davis,1,CIWW 102 Special Topic: Big Data science,cScI-GA.3033,3,0, NULL,Anasse Bari,1,60 Fifth Ave c10 Special Topic: Social Networks, csCI-GA. 3033,2,O, NULL, Bhubaneswar Mishra,2,CIWW 201 Special Topic: Cloud Computing,cSCI-GA.3033,4,O,NuLL,Jean Claude Franchitti,10,cIWw 102 Special Topic: Devops, csCI-GA.3033,1,0,NULL,John Rofrano,13,CIWw 317 Intro To Computer Programming, CSCI-UA.0002,4,0,NULL,Joseph Versoza, 2,CIww 312 Intro To Computer Programming, cscI-UA.0002,7,0,NULL, craig Kapp,3,cIww 109 Intro to Web Design & Computer Principles , CSCI-UA .0004, 6,0,NULL, Joshua Clayton, 1,CTWW 102 Intro to Web Design&Computer Principles, cscI-UA.0004,4,0,NULL, Amos Bloomberg, 4,60 Fifth Ave 150 Database Design And Web Implementation ,csci-UA.0060,5,0,NULL , Deena Engel , 1,60 Eifth Ave 110 Web Development And Programming , CSCI-UA0061 , 3,0,NULL,Nathan Hull,i.c1w 512 Intro To Computer science, csCI-uA.0101,4,o,NULL, suzanne McIntosh,1,60 Fifth Ave 110 Intro To Computer Science,CsCI-UA.0101,6,0, NULL, Evan Korth,2,CIWW 102 Data Structures,CSCI-UA. 0102,7,0, NULL,Anasse Bari,5,60 Fifth Ave 110 Computer systems Organization, CSCI-UA.0201,7,0, NULL, Randy Shepherd,1,60 Fifth Ave 150 Basic Algorithms, CSCI-UA.0310,5, o,NULL,victor Shoup,1,CIwW 109 Numerical Computing, CSCI-UA.0421,4, o, NULL,Michael overton,1,60 Fifth Ave C12 Theory Of Computation , CSCI-UA0453, 5, 0, NULL , Guy Kindler, 1,CIWW 201 Object Oriented Programming,CSCI-UA.0470,3, 0,NULL, Thomas Wies,l, CIWW 102 Intro To Machine Learning,CsCI-UA.0473,4,0, NULL, Kyunghyun Cho,1,60 Fifth Ave C12 Introduction to Robotics,CSCI-UA.0465,2,0,NULL,Chee Yap,1,CIWW 312 public class Course impLements java.io.Serializable t public String courseName: public String id; public int Maximum; public int Current; static ArrayList
students new ArrayList) public String instructor public int section; public String location; e public Course(String c,String i, int m, int cur, ArrayList s,String instructor, int section, String location) courseNameC idi; Maximumm Currentcur; studentsS this.instructor-instructor; this.section section this. Locationlocation; o public String getCourseName0 public int getCurrent() o public String getinstructor) o public String getidO public int getMaximum o public ArrayList getstudents) public int getsection) public String getlocation) e public void setCourseName (String courseName) 0 public void setMaximum(int Maximum) o public void setstudents (ArrayList students) o public void setsection(int section) public void setid (String id) public void setCurrent (int Current) o public void setinstructor(String instructor) public void setlocation(String location) static ArrayList courses = new ArrayList(); public static void main(String [1 args) try FileInputStream fis new FileInputStream("MyUniversityCourses.csv"); ObjectInputStream ois new ObjectInputStream(fis); ois.close) fis.close) catch(IOException ioe) ioe.printStackTrace() return; catch(ClassNotFoundException c) System.out.println("Class not found"); c.printstackTrace) return for(Course a :courses) System.out.print(a.getCourseName()); Course_Name, Course_Id, Maximum_Students, Current_Students,List_of_Names, Course Instructor,Course_Section_Number, Course_Location PAC II,csCI-GA.1144,7,0,NULL,Mohamed Zahran, 1,CIWW 312 Fundamental Algorithms, CSCI-GA.1170,4,0, NULL,Joel Spencer, 1,CIww 109 Programming Languages, CSCI-GA. 2110,7,0, NULL, Benjamin Goldberg, 1,CIWW 109 Compiler Construction , CSCI-GA. 2130, 3,0, NULL , Eva Rose, 1.c1w 202 Open Source Tools,cSCI-GA.2246,7,0,NULL,Jeffrey Korn,1,60 Fifth Ave c12 Operating Systems, CSCI-GA.2250,5,0,NULL, Hubertus Franke,1,CIWw 109 Database Systems, CSCI-GA.2433,4,0,NULL, Zvi Kedem,1,CIWW 101 Software Engineering,CSCI-GA.2440,7,0,NULL,Jean Claude Franchitti,1,CIWW 312 Web Search Engines,CSCI-GA.2580,6,0,NULL,Ernest Davis,1,CIWW 102 Special Topic: Big Data science,cScI-GA.3033,3,0, NULL,Anasse Bari,1,60 Fifth Ave c10 Special Topic: Social Networks, csCI-GA. 3033,2,O, NULL, Bhubaneswar Mishra,2,CIWW 201 Special Topic: Cloud Computing,cSCI-GA.3033,4,O,NuLL,Jean Claude Franchitti,10,cIWw 102 Special Topic: Devops, csCI-GA.3033,1,0,NULL,John Rofrano,13,CIWw 317 Intro To Computer Programming, CSCI-UA.0002,4,0,NULL,Joseph Versoza, 2,CIww 312 Intro To Computer Programming, cscI-UA.0002,7,0,NULL, craig Kapp,3,cIww 109 Intro to Web Design & Computer Principles , CSCI-UA .0004, 6,0,NULL, Joshua Clayton, 1,CTWW 102 Intro to Web Design&Computer Principles, cscI-UA.0004,4,0,NULL, Amos Bloomberg, 4,60 Fifth Ave 150 Database Design And Web Implementation ,csci-UA.0060,5,0,NULL , Deena Engel , 1,60 Eifth Ave 110 Web Development And Programming , CSCI-UA0061 , 3,0,NULL,Nathan Hull,i.c1w 512 Intro To Computer science, csCI-uA.0101,4,o,NULL, suzanne McIntosh,1,60 Fifth Ave 110 Intro To Computer Science,CsCI-UA.0101,6,0, NULL, Evan Korth,2,CIWW 102 Data Structures,CSCI-UA. 0102,7,0, NULL,Anasse Bari,5,60 Fifth Ave 110 Computer systems Organization, CSCI-UA.0201,7,0, NULL, Randy Shepherd,1,60 Fifth Ave 150 Basic Algorithms, CSCI-UA.0310,5, o,NULL,victor Shoup,1,CIwW 109 Numerical Computing, CSCI-UA.0421,4, o, NULL,Michael overton,1,60 Fifth Ave C12 Theory Of Computation , CSCI-UA0453, 5, 0, NULL , Guy Kindler, 1,CIWW 201 Object Oriented Programming,CSCI-UA.0470,3, 0,NULL, Thomas Wies,l, CIWW 102 Intro To Machine Learning,CsCI-UA.0473,4,0, NULL, Kyunghyun Cho,1,60 Fifth Ave C12 Introduction to Robotics,CSCI-UA.0465,2,0,NULL,Chee Yap,1,CIWW 312 public class Course impLements java.io.Serializable t public String courseName: public String id; public int Maximum; public int Current; static ArrayList students new ArrayList) public String instructor public int section; public String location; e public Course(String c,String i, int m, int cur, ArrayList s,String instructor, int section, String location) courseNameC idi; Maximumm Currentcur; studentsS this.instructor-instructor; this.section section this. Locationlocation; o public String getCourseName0 public int getCurrent() o public String getinstructor) o public String getidO public int getMaximum o public ArrayList getstudents) public int getsection) public String getlocation) e public void setCourseName (String courseName) 0 public void setMaximum(int Maximum) o public void setstudents (ArrayList students) o public void setsection(int section) public void setid (String id) public void setCurrent (int Current) o public void setinstructor(String instructor) public void setlocation(String location) static ArrayList courses = new ArrayList(); public static void main(String [1 args) try FileInputStream fis new FileInputStream("MyUniversityCourses.csv"); ObjectInputStream ois new ObjectInputStream(fis); ois.close) fis.close) catch(IOException ioe) ioe.printStackTrace() return; catch(ClassNotFoundException c) System.out.println("Class not found"); c.printstackTrace) return for(Course a :courses) System.out.print(a.getCourseName())