Threads

la vai uma básica de threads… qual é a saida?

[code]public class Foo {

 public static void main( String args[] )
 {
	  T1 t = new T1();
	  
	  t.start();
	  
	  synchronized( t ) 
	  {	  
		  try {

				t.wait();
				System.out.println( "a" );

		  } catch ( InterruptedException e ) { }
	  }
 }

}

class T1 extends Thread {

 public void run()
 {
	  synchronized( this )
	  {
			System.out.println( "b" );
			notify();
			System.out.println( "c" );
	  }
 }

}[/code]

b
a
c

???

Porfavor alguém depois explica :???:

[quote=“Fabio_Mendes”]b
a
c

???

Porfavor alguém depois explica :???:[/quote]

errou. hehee :slight_smile: , mais alguém?

b
c
a

pois o notify só surtirá efeito após a thread liberar o lock, o que ocorrerá no } do método run.

[quote=“hipersoft”]b
c
a

pois o notify só surtirá efeito após a thread liberar o lock, o que ocorrerá no } do método run.[/quote]

yeah! :cool: