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
Generally considered to be the most important information security policies, what item below defines the actions a user may perf
tamaranim1 [39]

Answer:

A. Acceptable use policies

Explanation:

These specific actions that the user may perform are all described in the acceptable use policy. The company usually requires that the user read and sign this policy before being granted a network ID into the system itself. By signing this agreement the individual user agrees to perform ONLY the actions listed in the agreement and nothing else and are restricted from unauthorized areas.

3 0
3 years ago
Que es un algoritmos
marin [14]
Algorithms: rules to follow when problem-solving
5 0
3 years ago
Read 2 more answers
A user called to inform you that the laptop she purchased yesterday is malfunctioning and will not connect to her wireless netwo
kakasveta [241]

Answer:

You can perform the following two steps

Explanation:

  1. Have the user press the appropriate function key combination to enable the wireless radio and then attempt to connect to the wireless network (since by mistake he could have disabled it).
  2. Ask the user to turn on the laptop’s airplane mode and attempt to reconnect to the wireless network (this mode basically what it does is disable adapters and activate it will connect the Wi-Fi network).
7 0
3 years ago
Beth would like to eavesdrop on network traffic resulting from users browsing the Web. Which port would provide her with the mos
Elis [28]

Answer:

port 80

Explanation:

port 80 is http. port 443 is https. so if you are trying to be a sneaky little person and eavesdrop on people, eavesdrop on port 80 not port 443 because port 80 is unsecured plaintext data transmission over websites

7 0
3 years ago
How does an author use artifacts in literature?
cestrela7 [59]
They use artifacts in l<span>iterature in order to develop the plot and the characters.</span>
7 0
3 years ago
Other questions:
  • What car dealership websites did you use to conduct your research?​
    8·1 answer
  • Explain what the 35ppm specification means
    13·1 answer
  • ________ to a base class may be assigned the address of a derived class object.
    8·2 answers
  • Write a c++ function, largestnum, that takes as parameters a double array and its size and returns the index of the last occurre
    14·1 answer
  • Aside from human user types, there are non human user groups. Known as account types, __________ are implemented by the system t
    10·1 answer
  • Sharon must give an informative presentation to a group of teenagers about cultivating earthworms for use in home gardening. Whi
    11·2 answers
  • Create a Card class that represents a playing card. It should have an int instance variable named rank and a char variable named
    12·1 answer
  • Help fast plzzzzzzzzzzzz ​
    10·2 answers
  • The average numbers of shares a piece of content receives is known as its:
    7·1 answer
  • Keegan has a hard drive that he wants to connect externally to his laptop. Which two ports can he connect the external hard driv
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!