M
manoj
here r 2 simple programs i have written
/////////progaram1//////////////////////////
public class db2 implements Runnable
{
private Thread dbThread ;
db2( String ipAddress )
{
System.out.println( "Got here1" ) ;
dbThread = new Thread( this , ipAddress ) ;
dbThread.start() ;
System.out.println( "Got here2" ) ;
}
public void run( )
{
System.out.println( "Got here3" ) ;
}
}
/////progarm 1 ends/////////////////////////////////
//////////////////program2///////////////
public class db extends db2 implements Runnable
{
private Thread dbThread ;
db()
{
super( "10.100.250.1" ) ;
dbThread = new Thread( this , "10.100.250.1" ) ;
dbThread.start() ;
}
public void run()
{
System.out.println( "In this run" ) ;
System.out.println( "in thread 2" ) ;
}
public static void main( String args[] )
{
db DB = new db() ;
}
}
/////program2 ends/////////////////////////
when i run "db" ie program2 the output is
//output/////////////////////
Got here1
Got here2
In this run
in thread 2
In this run
in thread 2
/////output ends////////////////
can anyone explain the output
can anyone explain why i am not getting "got here3" in program1
thanku
/////////progaram1//////////////////////////
public class db2 implements Runnable
{
private Thread dbThread ;
db2( String ipAddress )
{
System.out.println( "Got here1" ) ;
dbThread = new Thread( this , ipAddress ) ;
dbThread.start() ;
System.out.println( "Got here2" ) ;
}
public void run( )
{
System.out.println( "Got here3" ) ;
}
}
/////progarm 1 ends/////////////////////////////////
//////////////////program2///////////////
public class db extends db2 implements Runnable
{
private Thread dbThread ;
db()
{
super( "10.100.250.1" ) ;
dbThread = new Thread( this , "10.100.250.1" ) ;
dbThread.start() ;
}
public void run()
{
System.out.println( "In this run" ) ;
System.out.println( "in thread 2" ) ;
}
public static void main( String args[] )
{
db DB = new db() ;
}
}
/////program2 ends/////////////////////////
when i run "db" ie program2 the output is
//output/////////////////////
Got here1
Got here2
In this run
in thread 2
In this run
in thread 2
/////output ends////////////////
can anyone explain the output
can anyone explain why i am not getting "got here3" in program1
thanku