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
telo118 [61]
4 years ago
5

Analyze the following code:public class Test {public static void main(String[] args) {new B();}}class A {int i = 7;public A() {s

etI(20);System.out.println("i from A is " + i);}public void setI(int i) {this.i = 2 * i;}}class B extends A {public B() {// System.out.println("i from B is " + i);}public void setI(int i) {this.i = 3 * i;}}A) The constructor of class A is not called.B) The constructor of class A is called and it displays "i from A is 60".C) The constructor of class A is called and it displays "i from A is 40".D) The constructor of class A is called and it displays "i from A is 7".
Computers and Technology
1 answer:
Svetradugi [14.3K]4 years ago
8 0

Answer:

The answer is "Option B".

Explanation:

In the given java program the main class test is defined. Inside the class, class b instance is created. In the next line, two-class are defined that is class A and class B and class B inherit class A.

In both classes we define a constructor and a method setI(). This method calculates the value that is passed in function and This class uses Overriding concept. In the given question other options are wrong that can be described as:  

  • In option A, Class B inherits class A and when class b object is created it is automatically called.
  • In option C and option D, The constructor of class A is called but it displays 60, because of the constructor A call a function, that is setI() and passes value 20 parameter and because of using method overriding it display 60.
You might be interested in
Help with this robotics hw pls
enyata [817]
Hard to see, if you make it normal size I might b able to help
8 0
3 years ago
Software licensed as proprietary
steposvetlana [31]

Answer:

Does not permit source code changes.

Explanation:

3 0
3 years ago
Read 2 more answers
A network technician is assisting the security team with some traffic captures. The security team wants to capture all traffic o
Katyanochek1 [597]

Answer:

Option C i.e., Hub.

Explanation:

When network technician helps the support team with processing a few of the data. The support team needs to occupy both congestion between the router and the core switch over an individual subnet. To use it, the members must make sure there's only an individual collision as well as they broadcast IP address between both the router and the switch through which the congestion is received.

So, the technician installs the Hub to meet the following goal because It captures all the traffic on an individual subnet between them.

4 0
4 years ago
What is the value of the variable result after these lines of code are executed?
notsponge [240]

Answer:

5

Explanation:

6 0
3 years ago
Read 2 more answers
which program monitors the computer by looking for known trouble makers as well as suspicious behavior​
lys-0071 [83]

Answer:

i think spyware because spyware can collect almost any type of data, including personal information like internet surfing habits, user logins, and bank or credit account information. Spyware can also interfere with a user's control of a computer by installing additional software or redirecting web browsers.

Explanation:

3 0
3 years ago
Other questions:
  • The program prompts the user to interactively enter eight batting averages, which the program stores in an array. The program sh
    9·1 answer
  • Write a recursive method public static String reverse(String str) that computes the reverse of a string. For example, reverse("f
    6·1 answer
  • Universal Containers is implementing a community of High-Volume Community users. Community users should be able to see records a
    12·1 answer
  • Your friend’s parents are worried about going over their budget for the month. Which expense would you suggest is NOT a need?
    10·2 answers
  • 2. Use inheritance to create a hierarchy of Exception classes -- EndOfSentenceException, PunctuationException, and CommaExceptio
    6·1 answer
  • What computer is designed to meet the computing needs of several people simultaneously in a small to medium-size business enviro
    5·1 answer
  • the default name for the small icon that represents a web site or page, and is displayed in the browsers, typically at the begin
    9·1 answer
  • Given decimal variables named length and width that contain the dimensions of a rectangle, write a statement that calculates the
    12·1 answer
  • Which spreadsheet toolbar displays options such as Cut and Paste?
    11·2 answers
  • Write a class called TextProcessor that implements the methods listed below. Your implementation may use the charAt() and length
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!