How can we use wait and notify in Java?

0 votes
Please help!
Jul 12, 2018 in Java by Akrati
• 960 points
34 views

1 answer to this question.

0 votes

You can refer to this:

synchronized (someObject) 
{
    someObject.wait();
}


synchronized (someObject) 
{
    someObject.notify();
}
answered Jul 12, 2018 by sophia
• 1,400 points

Related Questions In Java

0 votes
2 answers

What is the use of toString method in Java and how can I use it ?

Whenever you require to explore the constructor ...READ MORE

answered Aug 23, 2018 in Java by Daisy
• 8,050 points
927 views
0 votes
3 answers

How can we use java.String.format in Scala?

String aString = "world"; int aInt = 20; String.format("Hello, ...READ MORE

answered Aug 29, 2018 in Java by Daisy
• 8,050 points
255 views
0 votes
2 answers

How can I create File and write data in it using Java?

import java.io.BufferedWriter; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; public class WriteFiles{ ...READ MORE

answered Jul 26, 2018 in Java by samarth295
• 2,190 points
132 views
0 votes
4 answers

How can we define global variables in java?

class G { static String globalVar ...READ MORE

answered Jan 29 in Java by zemiak
6,436 views
0 votes
1 answer

How to use wait() and notify() concept in producer consumer situation

In this program, we have two threads ...READ MORE

answered Jul 20, 2018 in Java by Kalgi
• 45,780 points
44 views
+5 votes
3 answers

How to execute a python file with few arguments in java?

You can use Java Runtime.exec() to run python script, ...READ MORE

answered Mar 27, 2018 in Java by DragonLord999
• 8,380 points

edited Nov 6, 2018 by Omkar 11,163 views
0 votes
1 answer

How to handle drop downs using Selenium WebDriver in Java

First, find an XPath which will return ...READ MORE

answered Mar 27, 2018 in Selenium by nsv999
• 5,110 points
2,406 views
0 votes
1 answer

What are the differences between getText() and getAttribute() functions in Selenium WebDriver?

See, both are used to retrieve something ...READ MORE

answered Apr 5, 2018 in Selenium by nsv999
• 5,110 points
6,224 views
0 votes
2 answers

How an object array can be converted to string array in java?

System.arraycopy is the most efficient way, but ...READ MORE

answered Aug 8, 2018 in Java by Sushmita
• 6,880 points
116 views
0 votes
1 answer

How to print java array in the simplest way?

String[] arr = new String[] {"John", "Mary", ...READ MORE

answered Apr 17, 2018 in Java by sophia
• 1,400 points
98 views