UrbanPro

Learn Java Training from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

Is synchronized keyword necessary, in Java, if everything that is modified in a function is local to that function?

Asked by Last Modified  

6 Answers

Learn Java

Follow 2
Answer

Please enter your answer

Technology Promoter

No, it is not required if you make sure whatever parameters are updated/modified will be done as atomic references/operations. Atomicity is an alternative to syncronizatiom.
Comments

Trainer

Not necessaring, if sharing is not there then synchronization is not required
Comments

The synchronized keyword is used in two primary contexts: as a method modifier to mark a method that it can only be executed by one thread at a time. by declaring a code block as a critical section – one that’s only available to a single thread at any given point in time
read more

The synchronized keyword is used in two primary contexts:

  1. as a method modifier to mark a method that it can only be executed by one thread at a time.
  2. by declaring a code block as a critical section – one that’s only available to a single thread at any given point in time
read less
Comments

If the function only works with local variables, then synchronized is not required. For example, a simple function for addition - "int add(int a, int b)", which takes two integers as parameter and returns summation of them, is not required to be synchronized. But if the function works on some class level...
read more
If the function only works with local variables, then synchronized is not required. For example, a simple function for addition - "int add(int a, int b)", which takes two integers as parameter and returns summation of them, is not required to be synchronized. But if the function works on some class level properties, global/static variables, or makes some calls to database system, or some I/O operation, then it may be required to make it synchronized to make the program thread safe. read less
Comments

Trainer

No, not necessary
Comments

In some cases It will be necessary. If you want to develop a thread-safe application then definitely you will have to use synchronized keyword.
Comments

View 4 more Answers

Related Questions

Is java a frontend or a middleware technology or both?
It's a programming language which is used to write application programs and is independent of platform.
Neha
0 0
5
What are the benefits of online training / e-training when compared to traditional contact training?
First of all, online training saves the time, money and energy of both student as well as teacher which is required for travelling. Online training can be conducted from any part of the world and I have...
Sadhu Sreenivasa Rao
What is 'this' in Java?
this is a keyword in Java. Works as a reference to current object whose constructor is being invoked
SEED Infotech Ltd

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

Java : Command Line Arguments
The parameters which are provided to the program at the command line. Eg:d:\>java a 10 20 30 Here,“java” is an interpreter, “a” is filename,10,20,30 are arguments passed to...
S

Svg Reddy

0 0
0

What Is Applet & Its Life Cycle?
What is Applet & its life cycle?Applet is a Java programme that can be embedded into HTML page.Java Applet runs on the java enables web browsers such as Mozilla & Internet Explorer.Applets are...
I

ICreative Solution

0 0
0

Internet of Things, Social Media Becoming Part of E-Discovery Landscape
The days when e-discovery consisted of handing over copies of e-mails to address Freedom of Information Act (FOIA) requests, compliance regulations or other legal obligations are over. Now, it's just as...

Java Achieve (JAR)
Java Archieve is a binary form to bundle a Java library which equivalent to zip file. It contains .class files, .properties, .jpeg, OR any supporting files to execute this library. For Example- junit.jar,...

Java Learning Tip
The easy way to learn any programatical language is just simple practices. Take a simple examples and practice daily one hour. And also go through the learning videos from youtube or somewhere else.

Recommended Articles

Java is the most commonly used popular programming language for the creation of web applications and platform today. Integrated Cloud Applications and Platform Services Oracle says, “Java developers worldwide has over 9 million and runs approximately 3 billion mobile phones”.  Right from its first implication as java 1.0...

Read full article >

Designed in a flexible and user-friendly demeanor, Java is the most commonly used programming language for the creation of web applications and platform. It allows developers to “write once, run anywhere” (WORA). It is general-purpose, a high-level programming language developed by Sun Microsystem. Initially known as an...

Read full article >

In the domain of Information Technology, there is always a lot to learn and implement. However, some technologies have a relatively higher demand than the rest of the others. So here are some popular IT courses for the present and upcoming future: Cloud Computing Cloud Computing is a computing technique which is used...

Read full article >

Java is the most famous programming language till date. 20 years is a big time for any programming language to survive and gain strength. Java has been proved to be one of the most reliable programming languages for networked computers. source:techcentral.com Java was developed to pertain over the Internet. Over...

Read full article >

Looking for Java Training Classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for Java Training Classes?

The best tutors for Java Training Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn Java Training with the Best Tutors

The best Tutors for Java Training Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more