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
xxTIMURxx [149]
3 years ago
14

If myClass has a constructor with a parameter of type String, select the other constructor that should be included.

Computers and Technology
1 answer:
JulijaS [17]3 years ago
7 0

Answer:

d. public myClass( ) {. . .}

Explanation:

A constructor is a special method that is called when an object of a class is created. It is also used to initialize the instance variables of the given class. A class may have one or more constructors provided that these constructors have different signatures. A class that does not have a constructor explicitly defined has a default parameterless constructor.

Having said these about a constructor, a few other things are worth to be noted by a constructor.

i. In Java, a constructor has the same name as the name of its class.

For example, in the given class <em>myClass</em>, the constructor(s) should also have the name <em>myClass</em>.

ii. A constructor does not have a return value. It is therefore wrong to write a constructor like this:

<em>public void myClass(){...}</em>

This makes option a incorrect.

iii. When a constructor with parameters is defined, the default parameterless constructor is overridden. This might break the code if some other parts  of the program depend on this constructor. So it is advisable to always explicitly write the default parameterless constructor.

This makes option d a correct option.

Other options b and c may also be correct but there is no additional information in the question to help establish or justify that.

You might be interested in
Which of the following is an example of a data base?
mihalych1998 [28]

See how long I can hold the key down. I forgot there was a max :/

 

hiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii

7 0
2 years ago
Monica and Tyrell agree upon the main problem they are facing as a team. What is the next step to finding a win-win solution? Ag
Pani-rosa [81]
Brainstorm possible solutions 
7 0
3 years ago
Read 2 more answers
a key part of staying safe is employing good habits. drag the step number to the proper sequence triple a
solong [7]

Answer:

where are the step number. I can't find any

6 0
3 years ago
which of these is defined as the smallest unit of infromation in a table? -character -field -record -object
sp2606 [1]

Answer:

character

Explanation:

character is the smallest unit of an information. It is also equivalent to one byte.

field is the collection of the combination of characters that make up a single fact.

record is the collection of related fields.

3 0
3 years ago
Read 2 more answers
Write two versions of a program that reads a sequence of positive integers from the user, calculates their geometric mean, and p
givi [52]

Answer:

1)

n = int(input("Please enter the length of the sequence: "))

print("Please enter your sequence")

product = 1

for i in range(n):

   val = int(input())

   product *= val

print("The geometric mean is: %.4f"%pow(product,1/n))

2)

print("Please enter a non-empty sequence of positive integers, each one is in a separate line. End your sequence by typing done:")

product = 1

val = input()

n = 0

while(val!="done"):

   product *= int(val)

   n += 1

   val = input()

print("The geometric mean is: %.4f"%pow(product,1/n))

Explanation:

4 0
3 years ago
Other questions:
  • What did Bill Gates invent?
    11·2 answers
  • Write a program to calculate how much to tip a waiter person based on the quality of service. The script file should ask for the
    12·1 answer
  • here are pros and cons for doing temp work. Please select the best answer from the choices provided T F
    9·2 answers
  • What does cmyk stand for?
    5·2 answers
  • Which descriptions offer examples of Correction Services workers? Select all that apply.
    8·1 answer
  • 8.Which of the following IC was used in third generation of computers?Immersive Reader
    13·1 answer
  • One of the functions of an IDE is to check for: flowchart errors. Syntax errors. memory errors X input and output.​
    12·2 answers
  • Describe the plot of the Matrix
    9·1 answer
  • If you had tickets for the concert and saw these alerts, what should you do?
    12·1 answer
  • A ________ is an application program that runs on a server-tier computer and manages processes such as items in a shopping cart
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!