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
Define Technology. Explain the term.​
aleksandrvk [35]

Answer:

Technology refers to methods, systems, and devices which are the result of scientific knowledge being used for practical purposes. Technology is changing fast. They should be allowed to wait for cheaper technologies to be developed.

7 0
3 years ago
Read 2 more answers
The number of output for a decoder if the input is 4
WINSTONCH [101]
To get the number ot decoder output:

2^n; where n is number of input
2^4
2 × 2 × 2 × 2 = 16 outputs

3 0
4 years ago
Give two differences between ergonomic keyboard and standard keyboard?​
galina1969 [7]

Answer:

The biggest difference between enhanced keyboards is the 12 function keys running across the top of the keyboard, instead of 10 that run down the left side. Other changes include the addition of extra Ctrl, keys, Alt keys, and cursor arrow keys between the letter keys and numeric keypad on the right side.

Explanation:

5 0
2 years ago
what does it mean when my brainly just tells me theres no answers for any of my questions i have the plus and ive been using it
VashaNatasha [74]
Well it might be a glitch or it didn’t save.
3 0
3 years ago
HELP PLEASE!
nasty-shy [4]

Answer:

It probably is fake. Send me a screenshot. Also, just saying if it asks you to download a app of something, dont do it its just a scam to make you panic.

Explanation:

3 0
3 years ago
Read 2 more answers
Other questions:
  • What is a Boolean Expression?
    12·1 answer
  • What is the difference between deta security and privecy ?
    12·2 answers
  • Which step can most directly help your team follow up on decisions made during Web development meetings?This task contains the r
    6·1 answer
  • When troubleshooting a desktop motherboard, you discover the network port no longer works. What is the best and least expensive
    10·1 answer
  • The ________________ command tests connectivity by sending an echo request to a remote computer.
    14·1 answer
  • In the beginning of wireless technology, some devices used _____ technology to "beam" information from one source to another sou
    14·1 answer
  • after pouring concentrated disinfectant on larger drops or pools of blood how much contact time should be allowed before attempt
    8·2 answers
  • Why do you think you are ready to handle the high school type of education and atmosphere? (in complete sentences)​
    11·1 answer
  • Which types of scenarios would the NETWORKDAYS function help calculate? Check all that apply.
    15·1 answer
  • Which of the following shows the assignment of a string to a variable? Select 3 options.
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!