Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1020069
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:06:38+00:00 2026-05-16T11:06:38+00:00

Here is the code I’m using. public class timerApp { Runnable timerRun = new

  • 0

Here is the code I’m using.

public class timerApp {
Runnable timerRun = new runX();
Thread thread1 = new Thread(timerRun);
public static void main(String[] args) {
    timerApp xyz = new timerApp();
    xyz.createGUI();
}
public void createGUI() {
    JButton button = new JButton("Start timer");
    JButton button2 = new JButton("Stop timer");
    JFrame frame = new JFrame();
    JLabel label = new JLabel("under_construction");
    frame.getContentPane().add(BorderLayout.NORTH,button);
    frame.getContentPane().add(BorderLayout.SOUTH,button2);
    frame.getContentPane().add(BorderLayout.CENTER,label);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(500,500);
    frame.setVisible(true);
    button.addActionListener(new b1L());
    button2.addActionListener(new b2L());
}
public class b1L implements ActionListener {
    public void actionPerformed(ActionEvent event) {
        thread1.start();
    }
}
public class b2L implements ActionListener {
    public void actionPerformed(ActionEvent event) {
        thread1.stop();
    }
  }
}

I get an error Note: timerApp.java uses or overrides a deprecated API. Note: Recompile with Xlint:deprecation for details.
I started getting this after adding the stop button’s listener class.

RELP!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T11:06:38+00:00Added an answer on May 16, 2026 at 11:06 am

    You get this warning as Thread’s stop() method is deprecated.

    Why is Thread.stop deprecated?

    Because it is inherently unsafe.
    Stopping a thread causes it to unlock
    all the monitors that it has locked.
    (The monitors are unlocked as the
    ThreadDeath exception propagates up
    the stack.) If any of the objects
    previously protected by these monitors
    were in an inconsistent state, other
    threads may now view these objects in
    an inconsistent state. Such objects
    are said to be damaged. When threads
    operate on damaged objects, arbitrary
    behavior can result. This behavior may
    be subtle and difficult to detect, or
    it may be pronounced. Unlike other
    unchecked exceptions, ThreadDeath
    kills threads silently; thus, the user
    has no warning that his program may be
    corrupted. The corruption can manifest
    itself at any time after the actual
    damage occurs, even hours or days in
    the future.

    Nice link:

    http://download.oracle.com/javase/1.4.2/docs/guide/misc/threadPrimitiveDeprecation.html

    This link provides info related to your question for :

    • Why is Thread.stop deprecated?
    • What should I use instead of
      Thread.stop?
    • How do I stop a thread that waits for
      long periods (e.g., for input)?
    • What if a thread doesn’t respond to
      Thread.interrupt?

    Why Are Thread.stop, Thread.suspend, Thread.resume and Runtime.runFinalizersOnExit Deprecated?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 534k
  • Answers 534k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer This is similar question, it might help. import os from… May 17, 2026 at 12:48 am
  • Editorial Team
    Editorial Team added an answer Can you use http://pinvoke.net/default.aspx/user32.EnumDisplayMonitors? Seems like once you get the… May 17, 2026 at 12:48 am
  • Editorial Team
    Editorial Team added an answer Since you have a data value and an associated timestamp,… May 17, 2026 at 12:48 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

here code delegate void CheckNewsDelegate(); void CheckNews() { frmNews news = new frmNews(); news.Show();
I have following code: public class readSensorsData extends Activity implements SensorListener { /** Called
public static void Command(string vCommand, string machineName, string username, string password) { ManagementScope Scope
Here is code in which I am trying to implement a queue using linked
Here is code: public interface IAccessPoint { int BackHaulMaximum { get; set; } bool
Ok the error is showing up somewhere in this here code if($error==false) { $query
A very stripped down example here . Code: function changeBackground() { var testDiv =
Why is substringFromIndex not working for my NSMutableString ? Here code similar to what
here is code: <script type=text/javascript> function doit(){ $('table td').each(function () { if ($(this).text().trim() !=
Here my code snippet: query.next(); qDebug()<<query.lastError(); qlonglong res=query.value(0).toLongLong(); qDebug()<<query.lastError(); and the corresponding log I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.