This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes stop () Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "stop ()" Watch "stop ()" New topic
Author

stop ()

hema janani
Ranch Hand

Joined: May 19, 2000
Posts: 70
hi
1.what method should be written in the foll. code to stop the thread from executing instead of stop(),at xxxx.
so that the output is "before the start method" only.
public class Q1 extends Thread
{
public void run()
{System.out.println("before start method");
//this.xxxx
System.out.println("after start method");
}
public static void main(String args[])
{
Q1 q=new Q1();
q.start();
}
}
Carl Trusiak
Sheriff

Joined: Jun 13, 2000
Posts: 3340
Originally posted by hema janani:
hi
1.what method should be written in the foll. code to stop the thread from executing instead of stop(),at xxxx.
so that the output is "before the start method" only.
public class Q1 extends Thread
{
public void run()
{System.out.println("before start method");
//this.xxxx
System.out.println("after start method");
}
public static void main(String args[])
{
Q1 q=new Q1();
q.start();
}
}

It depends on how you need to control things, Sun has a fairly good descussion on the depricated methods here : Java Thread Primitive Deprecation They also give suggestions on what to use instead of the deprecated methods, choose a statagy that best fits your application.

I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: stop ()