• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

stop ()

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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();
}
}
 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Don't mess with me you fool! I'm cooking with gas! Here, read this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic