Computers and Technology
Computers and Technology, 02.06.2021 20:30, hussja

public class Bird{private int beakStrength;public void Bird(int input){beakStrength = input;}public void setBeakStrength(int strength){beakStrength = strength;}}public class Hawk extends Bird{private int talonStrength;public Hawk(int talon, int beak){super(beak);talonStrength = talon;}}The following statement appears in a method in another class. Bird b = new Hawk(5, 8);Which of the following best describes the effect of executing the statement?A) The Bird variable b is instantiated as a Hawk. The instance variable talonStrength is initialized with the value from the parameter talon. The Hawk constructor cannot set the instance variable beakStrength because a subclass does not have access to a private variable in its superclass. B) The Bird variable b is instantiated as a Hawk. The call super(beak) returns a value from the instance variable beakStrength in the superclass and makes it accessible in the subclass. The instance variable talonStrength is then initialized with the value from the parameter talon. C) The Bird variable b is instantiated as a Hawk. The instance variable talonStrength is initialized with the value from the parameter talon. No other initializations are made to any instance variables. D) The Bird variable b is instantiated as a Hawk. The call super(beak) invokes the Bird constructor and initializes the instance variable beakStrength with the value from the parameter beak. The instance variable talonStrength is then initialized with the value from the parameter talon. E) The code segment will not execute because the Bird variable b cannot be instantiated as a Hawk.

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 21:00, calmicaela12s
The mode is generally used when delivering a presentation to an need now
Answers: 1
image
Computers and Technology, 23.06.2019 16:30, mirmir62
Which of the following is not an enhancement to the standard wiki to make it more attractive for corporations? encryptionwork spacespermission toolspredictive text
Answers: 2
image
Computers and Technology, 24.06.2019 22:10, gabriellabadon2
In command prompt, whats a command that will list only .ini files in c: \windows\system32 directory?
Answers: 1
image
Computers and Technology, 25.06.2019 05:00, quintinlarrieu
Brad wants to buy flowers for his friend with 33 dollars. the daisies are 1 dollar each and the roses are 2 dollars each he buy 3 more daisies than roses how much did the roses cost
Answers: 2
Do you know the correct answer?
public class Bird{private int beakStrength;public void Bird(int input){beakStrength = input;}public...

Questions in other subjects:

Konu
Mathematics, 06.05.2020 04:16