Why we can't just insert the mat
, cou
, stat
, cg
into the ArrayList
's parentheses ? Why do we need to insert the object which stu
into the parentheses?
ArrayList arrList = new ArrayList ();
for ( int k = 1, k<101 , k++)
{
System.out.print ( "Matric : ") ;
String mat = sc.nextLine;
System.out.print ( "Course: ") ;
String cou = sc.nextLine;
System.out.print ( "Status: ") ;
String stat = sc.nextLine;
System.out.print ( "cgpa : ") ;
String cg = sc.nextDouble;
Student stu = new Student ( mat , cou, stat,cg);
ArrList add(stu);
}