





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






Also, may need to return more than one parameter
Other Classes used by “Student” Note: private Date birthDate; Requires class “Date”. This is defined in separate file Date.java in the same directory. Similarly private Course[] courseList; Requires the class “Course”, defined in Course.java. These three files constitute a “package”. If they are in the same directory, Java automatically recognizes them as a package Please save these files to the same directory and test: Student.java Course.java Date.java
Student Class: Constructors // Default constructor public Student() { // initialise instance variables birthDate = new Date(); courseList = new Course[MAX_COURSES]; } /** Constructor with roll number */ public Student(String roll) { rollNum = roll; birthDate = new Date(); courseList = new Course[MAX_COURSES]; }
Multidimensional Arrays
Note: Array elements get default values. E.g. numericals get zero. Can also initialize multidim arrays: int [] [] magicSquare = { {8, 1, 6} , {3, 5, 7}, {4, 9, 2} };
Non-uniform rows Arrays