What is the name of the ArrayList variable in the code?

void enrollStudents(int x)

{

roster = new ArrayList();

while(x>0)

{

Student s = new Student();

s.setGrades( Math.random()*4,

Math.random()*4,

Math.random()*4,

Math.random()*4,

Math.random()*4,

Math.random()*4 );

roster.add(s);

x--;

}

}

And here’s another one:

void enrollStudents(int x)

{

roster.clear();

for(int i=0; i<x; i++)

{

Student s = new Student();

double g = Math.random()*4;

s.setGrades(g, g, g, g, g, g);

roster.add(s);

}

}

1 Answer

Relevance
  • 1 decade ago
    Best Answer

    Is this like a joke question?

    Roster is initialized as an ArrayList :)

Still have questions? Get your answers by asking now.