Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7809315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T03:23:47+00:00 2026-06-02T03:23:47+00:00

https://i.stack.imgur.com/D01ja.png So, I’m reading a pdf about synchronization that shows the above example problem.

  • 0

https://i.stack.imgur.com/D01ja.png

So, I’m reading a pdf about synchronization that shows the above example problem. A bit later, the following is presented, presumably as a solution:

class Account
{
  private double balance;
  public Account(double initialDeposit) {
    balance = initialDeposit;
  }
  public synchronized double getBalance() {
    return balance;
  }
  public synchronized void setBalance(double newBalance) {
    balance = newBalance;
  }
  public synchronized void deposit (double amt) {
   //essentially still multiple steps when in bytecode!
   balance += amt;
  }

I don’t understand how this solves the problem. Maybe that’s not what was intended, but it seems implied. I’m looking for some confirmation on whether it does or doesn’t.
}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T03:23:48+00:00Added an answer on June 2, 2026 at 3:23 am

    The point of using the synchronized keyword is that only one thread can access the method at a time and the schema on your image becomes impossible.

    But as discussed below, the presence of the setBalance method makes it possible to misuse the class and obtain an undesired output.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two grayscale Png files( https://i.stack.imgur.com/8RGh4.jpg ) that I want consider as a
I have a html document that has this structure: https://i.stack.imgur.com/zrOq1.png <- sorry for link,
I want to create a DashBoard in my Application like that https://i.stack.imgur.com/uDwlf.png . The
https://i.stack.imgur.com/bhrYD.png here is a screenshot I am trying to style it such that the
here's the example: http://jsbin.com/izegoy problem: https://i.stack.imgur.com/XSHZR.png script: $(document).ready(function(){ $(p:eq(1)).hide().after(<span>View more</span>); $(span).click(function(){ $(p:eq(1)).slideToggle(200,function(){ if($(span).text()==View more){
https://i.stack.imgur.com/2KxdM.png I have this segmented control that I made, however I don't know how
This is my site : http://searchr.us/ https://i.stack.imgur.com/FQKTS.png When i click on that.Firefox and Internet
Here is a PNG file: https://i.stack.imgur.com/AHOgE.png (Yes, never mind that it's a funny penguin
I have table called 'shipped_data' https://i.stack.imgur.com/JXBej.png and need go get all 'caseNumbers' that match
How would I go about creating a navigation bar which looks like this: https://i.stack.imgur.com/bbaCz.png

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.