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
sashaice [31]
3 years ago
13

Assume that class BankAccount exists, and that it has a constructor that sets the private field balance, and that setBalance and

getBalance are defined by class BankAccount and set and get double values. Then what is the output of the following code:________.
a. 600.0
b. 0.0
c. 300.0
d. null
e. an error will result
Computers and Technology
1 answer:
Ainat [17]3 years ago
4 0
<h2>Question:</h2>

Assume that class BankAccount exists, and that it has a constructor that sets the private field balance, and that setBalance and getBalance are defined by class BankAccount and set and get double values.

Then what is the output of the following code?

BankAccount b1 = new BankAccount(600.0);

BankAccount b2 = b1;

b1.setBalance(300.0);

System.out.println(b2.getBalance() );

<h2>Answer:</h2>

300.0

<h2>Explanation:</h2>

The given snippet of code is as follows:

=======================================

BankAccount b1 = new BankAccount(600.0);

BankAccount b2 = b1;

b1.setBalance(300.0);

System.out.println(b2.getBalance() );

=======================================

<u><em>Line 1</em></u>: An object b1 of the BankAccount class is created which sets the value of its <em>balance </em> to 600.0

<u><em>Line 2</em></u>: A second object, <em>b2</em>, is created referencing or pointing to the first object, <em>b1 </em>in memory. It could also be interpreted to mean that a second object <em>b2</em> is created from the exact copy of the first object, b1. This is called <em>object cloning</em>. This by implication means that all the fields (including the contents of the fields) of the first object b1, are copied to b2 which also means that when there's a change in b1, an update is made to b2 also. If a change is made to b2, b1 also gets updated.

<u><em>Line 3</em></u>: Object <em>b1</em> is updated by setting the value of its <em>balance</em> field to 300.0 using the setBalance() method. This will also update the same field for the second object <em>b2.</em>

<em />

<u><em>Line 4</em></u>: The value of the <em>balance</em> field of object b2 is being printed to the console. Since the value has been updated in line 3 when that of b1 was updated, <em>300.0</em> will be printed to the console.

<em />

<em />

You might be interested in
After logging into your Blackboard account, you will never be required to enter a separate password provided by your instructor
FinnZ [79.3K]

Answer:

False.

Explanation:

If the institute in which you are enrolled have blackboard account for you then you are given a login ID and password which can be used to login onto the website.

But after logging in you are required to enter a separate password given by the instructor to begin the test.So we conclude that the answer to this question is False.

5 0
4 years ago
Which of the following is the output of the code
olya-2409 [2.1K]

Answer:

need to see code

3 0
4 years ago
De dónde proviene la mayoría de cosas que utilizamos en el hogar​
Mashutka [201]

Answer:

La mayoría de las cosas que utilizamos en el hogar proviene de distintas industrias ubicadas a lo largo y ancho del mundo, dado que vivimos en un mundo globalizado e industrializado, en el que las distintas naciones intercambian bienes y servicios a través del comercio internacional.

De esta manera, en los distintos hogares hay cosas de diversos orígenes, como electrodomésticos provenientes de China, Japón o los Estados Unidos, muebles provenientes de México o Suecia, alimentos provenientes de Argentina, etc.

7 0
3 years ago
When you use the Bing Image Search for online pictures, you will be searching the Internet for pictures that have been filtered
just olya [345]

Answer:

Creative commons licensing system

Explanation:

If you use the Bing image search you will be searching the Internet for pictures that have been filtered based on the creative Commons licensing system meaning you will have to search the internet for picture that have licence that will give you the right to have the pictures because the owner has given you the licence to share or use the picture he created

Therefore Commons licenses is the licenses to get permission to do any of the things with a work that the law reserves exclusively to a licensor and that the license does not expressly allow.

7 0
3 years ago
Read 2 more answers
What type of computer lies between micro and mainframe computer?
avanturin [10]

Answer:

Mini computer lie between micro and mainframe Computer.

Hope it will help you :)

3 0
3 years ago
Other questions:
  • Para que se utiliza openoffice en la vida cotidiana?
    7·2 answers
  • Question 16 (1 point)
    15·1 answer
  • In 2011 a program named Watson running on an IBM supercomputer
    12·1 answer
  • What do you call the destination router on the network endpoint?
    7·1 answer
  • Which option should you select to accept a tracked change? A. Accept B. Reject C. Review D. Delete
    8·2 answers
  • Dell Computer uses recycled and recyclable materials in its product and packaging design in an effort to minimize damage to the
    5·1 answer
  • To add a glow effect to WordArt text, which of the following should be done?
    11·1 answer
  • why does planets orbit the sun? asap i give brainlist i know it on that subject i dont know what else goes with it
    10·1 answer
  • Assume you are a manager in the security department of a high-tech corporation. You are mentoring Mary, an entry-level network t
    7·1 answer
  • SO I LIKE BOILED EGGS AND MY MUM WAS MAKING SALAD FOR DINNER SO I SAID DID YOU MAKE AND EGG-TRA ONE FOR ME
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!