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
Which statement is false? Select one: a. Function printf does not care how large the array it is printing is. b. Function scanf
dusya [7]

Answer:

Option A

Explanation:

Because each function has specific amount of space allocated by default on the stack, so it cares about the length of the array being printed by it. By default the space is up to 100 kb but this size can be increased by setting it manually.

Option B is correct answer because scanf takes input from user until first space is hit.

6 0
4 years ago
Select the correct statement(s) regarding Frame Relay (FR). a. FR is a connection-oriented standard that operates at the OSI lay
DedPeter [7]

Answer:

d. all of the statements are correct

Explanation:

Frame Relay is a high-performance WAN protocol that operates at the physical and data link layers of the OSI reference model. i.e Layers 1 and 2 They are designed to cope with bursty traffic. Frame relay is also a form of data networking based on packet switching in which the packets are variable in length and experience packet delays.

Based on the above definition the correct statement is option d as all of the statements define in the other option correctly defines the function of frame relay.

7 0
3 years ago
What are 3 ways to get friends to stop texting and driving?
Leni [432]
Not allow them to use their phone, tell them you won’t get in the car with them unless they stop texting and driving, inform their parents
3 0
3 years ago
Read 2 more answers
Port explorers ​are tools used by both attackers and defenders to identify (or fingerprint) the computers that are active on a
Evgesh-ka [11]

Answer:

b) False.

Explanation:

Port explorers ​are tools used by both attackers and defenders to identify (or fingerprint) the computers that are active on a network, as well as the ports and services active on those computers, the functions and roles the machines are fulfilling, anAn IDPS can be configured to dial a phone number and produce an alphanumeric page or other type of signal or message., is a FALSE statement.

5 0
3 years ago
Which statement is false? arrays may contain pointers. each entry in an array of strings is actually a pointer to the first char
konstantin123 [22]
<span>each entry in an array of strings is actually a pointer to the first character of a string

Each indice in an array of strings (which are actually each actually an array of char) is actually a pointer to the first (0th) char of a string.
</span>
4 0
3 years ago
Other questions:
  • What is data called that is input into a cryptographic algorithm for the purpose of producing encrypted data?
    14·1 answer
  • The disk drive is a secondary storage device that stores data by _____ encoding it onto a spinning circular disk.
    14·1 answer
  • Unlike the String class where you must pass a message to an object (instance) of the class, as in x.length( ), in order to use e
    12·1 answer
  • Pamela finds that she is constantly spelling the word “color” as “colour” when she is typing. Even though this is how the word i
    11·1 answer
  • ou have spent the last two hours creating a report in a file and afterwards you use cat to create a new file. Unfortunately the
    13·1 answer
  • Suppose an application generates chunks of 20 bytes of data every 20 msec, and each chunk gets encapsulated in a TCP segment and
    14·1 answer
  • In which circumstances would the view side by side feature be useful or helpful.
    15·2 answers
  • 1. Choose a real or made up company, and describe at least three ways in which the company uses technology. (1-3 sentences. 3.0
    13·1 answer
  • Create an application named SalesTransactionDemo that declares several SalesTransaction objects and displays their values and th
    12·1 answer
  • Which of the following media forms is the Federal Communications Commission able to regulate content on?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!