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
SVEN [57.7K]
3 years ago
15

Which code fragment constructs an arrray list named players that is initialized to contain the strings "player 1" and "player 2"

?
Computers and Technology
1 answer:
Lyrx [107]3 years ago
7 0
The code used to construct an array of player names is a variable
You might be interested in
"The ability to create methods with the same name that are in different classes" is known as ________.
Jlenok [28]

Answer:

Polymorphism

Explanation:

Polymorphism is the ability of an object to take multiple forms. It is an important concept of Object Oriented Programming. Polymorphism is used in Object Oriented Programming when a reference of a parent class is used to refer to a child class object. It allows to perform a single action in different ways. For example a person can possess different characteristics at the same time. A person can be a father, husband, employee or student. The same person can have different behaviors in different circumstances.

Example:

Suppose there is class Animal with a procedure sound(). This method can have different implementation for different animals. For this purpose lets take two derived classes Cow and Cat that extend the Animal class (parent/base class). Now the method sound() can be used in different ways for Cow and Cat.

public class Animal{

public void sound(){

System.out.println("Animal is making a sound");  } }

public class Cat extends Animal{

 public void sound(){

  System.out.println("Meow");     } }

The output is Meow. The same method sound() is used for cat subclass.

public class Cow extends Animal {

  public void sound(){

    cout<<"Mooo";  }}

The output is Mooo. The method sound() is used for a Cow subclass which returns the sound of Cow in output.

So the same function i.e. sound() behaves differently in different situations which shows Polymorphism.

Polymorphism has 2 types.

One is compile time polymorphism which is called overloading. In method overloading a class can have more than one functions with same name but different parameters. Methods can be overloaded by change in number or type arguments. For example overloading a function method() can take the following forms in which the name remains the same and parameters are different.

void method(int a)

void method(float a)

void method(float a, float b)

Second type is run time polymorphism which is called overriding. Method overriding is when a method declared in derived class is already present in base class. In this way derived/child class can give its own implementation to base/parent class method. Method present in base class is called overridden and that in subclass is called overriding method. The example of Animal Cow and Cat given above is an example of overriding.

6 0
3 years ago
Top 5 best comedy or action movies.
Cloud [144]
Comedy movies you should watch is
grown ups
spider man into the spider verse
action movies you can do
like a fast and furious movie ?
some cool scary movies are
the strangers
insidious
and the serbian film :)
7 0
3 years ago
Read 2 more answers
Go to the Creamy Ice Corporation passage on the next page. Insert the trademark sign after the word “Corporation'' in the first
GuDViN [60]

Answer:

v

Explanation:

because it is

5 0
3 years ago
What is the first step in creating a maintenance ?
tankabanditka [31]
The first step would be knowing the manufacturer s recommended schedule for maintenance
7 0
3 years ago
ASAP HELP
vovangra [49]

Answer:@the bottom slide

Explanation:wats ya email i

will help u

8 0
3 years ago
Other questions:
  • Write a for loop that iterates from 1 to numbersamples to double any element's value in datasamples that is less than minvalue.
    15·1 answer
  • You can avoid culture shock by ____________.
    10·2 answers
  • How can our perceptions help us to choose the channel for our message?
    5·1 answer
  • . An access specifier is one of three keywords:
    14·1 answer
  • How do you freeze the total cell so that it doesn't change when copied?
    6·1 answer
  • Which statement is false? Select one: a. Function printf does not care how large the array it is printing is. b. Function scanf
    9·1 answer
  • Which descriptions offer examples of Correction Services workers? Select all that apply.
    8·1 answer
  • You are moving to an area where DSL will be available in the next six months. Which method of internet connectivity should you i
    13·1 answer
  • Application of computer in insurance​
    14·1 answer
  • What type of error occurred with the code below??
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!