Click here to Skip to main content
15,926,703 members
Home / Discussions / Java
   

Java

 
GeneralRe: VPN project tips?? Pin
Strategic_Thinker22-Apr-10 6:35
Strategic_Thinker22-Apr-10 6:35 
GeneralRe: VPN project tips?? Pin
Paul Conrad22-Apr-10 6:43
professionalPaul Conrad22-Apr-10 6:43 
Questioninserting byte array into mysql DB Pin
Evgeni5720-Apr-10 0:06
Evgeni5720-Apr-10 0:06 
AnswerRe: inserting byte array into mysql DB Pin
David Skelly20-Apr-10 1:52
David Skelly20-Apr-10 1:52 
QuestionPlacing a label inside a label using swing Pin
PJanaki19-Apr-10 19:01
PJanaki19-Apr-10 19:01 
AnswerRe: Placing a label inside a label using swing Pin
TorstenH.20-Apr-10 23:42
TorstenH.20-Apr-10 23:42 
GeneralRe: Placing a label inside a label using swing Pin
PJanaki21-Apr-10 23:53
PJanaki21-Apr-10 23:53 
QuestionWait and Notify Issue.. Pin
sujan.vb.net19-Apr-10 15:22
sujan.vb.net19-Apr-10 15:22 
public class Interference extends Thread {

	/**
	 * @param args
	 */
	String name;
    static boolean isZero = true;
    static int counter = 0;
    public static void main(String arg[]) {
    	
    	MyThread m = new MyThread();
    	m.setName("Important Thread");
    	m.start();

			synchronized(m){
				    	try {
				    		System.out.println("Waiting for " + m.getName() + " to Complete....");
							m.wait();
						} catch (InterruptedException e) {
							
							e.printStackTrace();
						}
			}
        System.out.println("Main Work Started");
        System.out.println("Hello");
    }
   
    Interference(String nameString) {
        name = nameString;
    }
    public void run() {
    	System.out.println(name + " Started....");
        for(int i=0; i<100000000; i++) {
            if(isZero) {
                isZero = false;
                counter++;
            } else {
                isZero = true;
                counter--;
            }
        }
        System.out.println(name + ": " + counter);
    }

}

class MyThread extends Thread
{
	public void run()
	{
		System.out.println(Thread.currentThread().getName()+" : Let me finish first !");
		Interference inter = new Interference("NEW");
		inter.start();
		try {
			inter.join();
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		for(int i =0;i<1000;i++){}
		System.out.println(Thread.currentThread().getName()+" : OK! do your work now");
			
	}
}


The above code demonstrates a wait and notify scenario but I have not notified the object after MyThread's work finishes. I'm amazed that without notifying, how the wait() breaks. can anybody explain me.
AnswerRe: Wait and Notify Issue.. Pin
David Skelly20-Apr-10 2:09
David Skelly20-Apr-10 2:09 
QuestionHeap Size in Windows7 ? Pin
002comp18-Apr-10 22:55
002comp18-Apr-10 22:55 
AnswerRe: Heap Size in Windows7 ? Pin
Richard MacCutchan19-Apr-10 1:28
mveRichard MacCutchan19-Apr-10 1:28 
GeneralRe: Heap Size in Windows7 ? Pin
002comp19-Apr-10 2:02
002comp19-Apr-10 2:02 
GeneralRe: Heap Size in Windows7 ? Pin
Richard MacCutchan19-Apr-10 3:15
mveRichard MacCutchan19-Apr-10 3:15 
Questionimplementation of any DHT in java Pin
amitesheti18-Apr-10 9:01
amitesheti18-Apr-10 9:01 
AnswerRe: implementation of any DHT in java Pin
Richard MacCutchan18-Apr-10 11:11
mveRichard MacCutchan18-Apr-10 11:11 
QuestionJava ME help - highscore Pin
alexwilliams217-Apr-10 11:38
alexwilliams217-Apr-10 11:38 
AnswerRe: Java ME help - highscore Pin
Kristian Sixhøj18-Apr-10 9:18
Kristian Sixhøj18-Apr-10 9:18 
Questiongui in java Pin
igalep13216-Apr-10 3:43
igalep13216-Apr-10 3:43 
AnswerRe: gui in java Pin
David Skelly16-Apr-10 6:38
David Skelly16-Apr-10 6:38 
GeneralRe: gui in java Pin
igalep13216-Apr-10 22:25
igalep13216-Apr-10 22:25 
GeneralRe: gui in java Pin
AmbiguousName17-Apr-10 0:35
AmbiguousName17-Apr-10 0:35 
GeneralRe: gui in java Pin
igalep13217-Apr-10 0:53
igalep13217-Apr-10 0:53 
GeneralRe: gui in java Pin
David Skelly19-Apr-10 22:32
David Skelly19-Apr-10 22:32 
QuestionClose JFrame using JButton?? Pin
AmbiguousName16-Apr-10 2:20
AmbiguousName16-Apr-10 2:20 
QuestionObject Pannin problem in Java 3D Pin
ShafiqA14-Apr-10 2:19
ShafiqA14-Apr-10 2:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.