UrbanPro

Learn Java Training from the Best Tutors

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

Search in

Where is the synchronized method used in java?

Asked by Last Modified  

4 Answers

Learn Java

Follow 2
Answer

Please enter your answer

Private Online Java Training by Exp Software Engineer

synchronized means that in a multi threaded environment, an object having synchronized method(s)/block(s) does not let two threads to access the synchronized method(s)/block(s) of code at the same time. This means that one thread can't read while another thread updates it. The second thread will instead...
read more
synchronized means that in a multi threaded environment, an object having synchronized method(s)/block(s) does not let two threads to access the synchronized method(s)/block(s) of code at the same time. This means that one thread can't read while another thread updates it. The second thread will instead wait until the first thread completes its execution. read less
Comments

The synchronized method is used in java to lock an object for any shared resource.
Comments

Tutor

If we keep synchronized keyword in front of the method , that will allow only 1 thread at a time to execute that method. Its basically used in multi thread programming.
Comments

IT Professional Salesforce CRM trainer

When one thread is executing a synchronized method for an object, all other threads that invoke synchronized methods for the same object block until the first thread is done with the object.i.e at a time one thread can access shared variable. please refer following code example: class disp { ...
read more
When one thread is executing a synchronized method for an object, all other threads that invoke synchronized methods for the same object block until the first thread is done with the object.i.e at a time one thread can access shared variable. please refer following code example: class disp { void display(String nm) { System.out.print("Mr "); try{Thread.sleep(2000);}catch(Exception e){} System.out.print(nm); System.out.println(" Das"); } } class syn implements Runnable { disp ob; String s; syn(disp ob1,String s1) { ob=ob1;s=s1; Thread t=new Thread(this); t.start(); } public void run() { synchronized(ob) { ob.display(s); } } } class synmain { public static void main(String ars[]) { disp ob=new disp(); new syn(ob,"ram"); new syn(ob,"shyam"); new syn(ob,"Hari"); new syn(ob,"jadu"); new syn(ob,"Madhu"); } } read less
Comments

View 2 more Answers

Related Questions

What is difference between throw and throws in Java programming?
throw keyword is used to throw Exception from any method or static block in Java while throws keyword, used in method declaration, denoted which Exception can possible be thrown by this method
Vinodha
Why does â??5/2 = 2â?? and not 2.5 in Python?
Due to dynamic Typing. use Numpy , and declare data type , you will get desired result
Srikanth
0 0
6
will I get certificate
Better than certificate if you enroll with me you will get confidence and lot of practical knowledge...certifications dont matter after a period of time what really matters is your approach to a problem...
Sk.
what is serialVersionUID , why it different for each bean? serialVersionUID = 42L;
The serialization runtime associates with each serializable class a version number, called a serialVersionUID, which is used during deserialization to verify that the sender and receiver of a serialized...
Srilatha N
Can anyone know if there are tools/apps for representing the objects/classes/methods in the JVM in pictorial way?
rational rose and ibm software architect can be used for design and representation
Raghavendra Reddy
0 0
7

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

Ask a Question

Related Lessons

COMPILATION AND INTERPRETATION
Compilation and Interpertation Process javac (compiler) java(interpreter)high level code - > compile - > bytecode - > interperted - > machine code Bytecode...

Spring - Dependency Injection (DI)
Spring - Dependency Injection (DI) DI is a framework which provides loose coupling in code. Here loose coupling means no hard coding of the object. Instead of hard coding, we will be injecting these object...

Tips of learning Java Language/Other Programming Languages
1.You should know the basic concept: If we talk about programming languages so basic concept are same in all the high level languages. So you should know the basic concept firstly then you can easily understand...
I

ICreative Solution

0 0
0

Introduction to Course Content
Video about what we are going to learn throughout the Java Training Session .

How To Setup development Environment Of Java?
After installation of JAVA, we need to setup 2 environment variables. First one is JAVA_HOME and second is Path. Below steps to set up Java environment to compile & execute Java programs from command...

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 >

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 >

Before we start on the importance of learning JavaScript, let’s start with a short introduction on the topic. JavaScript is the most popular programming language in the world, precisely it is the language - for Computers, the Web, Servers, Smart Phone, Laptops, Mobiles, Tablets and more. And if you are a beginner or planning...

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