1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Luba_88 [7]
3 years ago
14

A teacher wants to create a list of students in her class. Using the existing Student class in this exercise. Create a static Ar

rayList called classList that adds a student to the classList whenever a new Student is created. In the constructor, you will have to add that Student to the ArrayList.

Computers and Technology
1 answer:
aleksandr82 [10.1K]3 years ago
4 0

Answer:

Check the explanation

Explanation:

CODE:-

import java.util.ArrayList;

class Student

{

  private String name;

  private int grade;

  private static ArrayList<Student> classList = new ArrayList<Student>();

 

  public Student(String name, int grade)

  {

      this.name = name;

      this.grade = grade;

      classList.add(this);

  }

 

  public String getName()

  {

      return this.name;

  }

 

  /*Don't change the code in this method!

  This method will print out all the Student names in the classList Array

  */

  public static String printClassList()

  {

      String names = "";

      for(Student name: classList)

      {

          names+= name.getName() + "\n";

      }

      return "Student Class List:\n" + names;

  }

}

public class ClassListTester

{

  public static void main(String[] args)

  {

      //You don't need to change anything here, but feel free to add more Students!

      Student alan = new Student("Alan", 11);

      Student kevin = new Student("Kevin", 10);

      Student annie = new Student("Annie", 12);

      Student smith = new Student("Smith", 11);

      Student kane = new Student("Kane", 10);

      Student virat = new Student("Virat", 12);

      Student abd = new Student("ABD", 12);

      Student root = new Student("Root", 12);

      System.out.println(Student.printClassList());

  }

}

Kindly check the attached image below.

You might be interested in
Sometimes a database can contain "bad data," meaning incomplete, incorrect, inaccurate, or irrelevant records, which can be corr
sergey [27]

Answer:

True.

Explanation:

The database can contain "bad data".

Bad Data is incorrect,incomplete,irrelevant or inaccurate records and the bad data can only be corrected or by data cleansing.

Data cleansing is deleting the bad data from the database.It is very important technique which is implemented by almost every one dealing with bad data.

Hence we conclude that the answer to this question is True.

4 0
3 years ago
What does "FDDI" stand for in Technology?
Komok [63]
Pretty sure it's Fiber Distributed Data Interface
6 0
3 years ago
Read 2 more answers
When you save a presentation with a .potx file extension, which type of powerpoint file is created?
Elena L [17]
A file with the POTX file extension is a Microsoft PowerPoint Open XML Template file used to maintain the same layout, text, styles, and formatting across multiple PPTX files.
6 0
2 years ago
Which of the following provides astronomical evidence for the age of the earth?
Anestetic [448]

A. movement of galaxies

3 0
3 years ago
WHAT ARE THE USES OF COMPUTER SCIENCE AND INFORMATION TECHNOLOGY
ad-work [718]
As for this kind of definition question, you can search the answer online. Thank you
7 0
2 years ago
Other questions:
  • What is the outlined area called?
    6·1 answer
  • A label is any word that appears in a cell of a spreadsheet.<br> True<br> False
    5·2 answers
  • In this mode, your presentation will fill up the entire screen. Auto Default Standard Window
    6·2 answers
  • To edit the color of the text in presentation software, choose the Font color command Text Color in the ________ ribbon toolbar.
    15·2 answers
  • What is wrong with line 1?
    14·1 answer
  • Which type of computer operating system would be best for a large corporation?
    7·2 answers
  • What is information associated with a document to help describe that document called?
    12·1 answer
  • Write a Java program to count the characters in each word in a given sentence?Examples:Input : geeks for geeksOutput :geeks-&gt;
    10·1 answer
  • Which country was the first in the world to launch a mass media campaign in response to population growth?
    14·1 answer
  • You are given a 5-letter word (for example, abcde). Write a C-Program which outputs all possible unique 5 letter permutations of
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!