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

Related Questions

Here a code to demonstrate an annoying problem: class A { public: A(): m_b(1),
Here is code example class A{ int i; public: A(int i) : i(i) {}
here code delegate void CheckNewsDelegate(); void CheckNews() { frmNews news = new frmNews(); news.Show();
here is code for regular expression matching #include<iostream> #include<stdio.h> #include<string.h> using namespace std; int
I have following code: public class readSensorsData extends Activity implements SensorListener { /** Called
Here my code <a href=http://linkurl class=link title=sometitle> text link <span class=hidden-tooltip-data style=display: none;> <a
I have UiTextView where I want change font size (increase), here code -(void)biggerFont:(UIBarButtonItem *)
public static void Command(string vCommand, string machineName, string username, string password) { ManagementScope Scope
The script is on jsfiddle here : CODE What it does at the moment
Ok the error is showing up somewhere in this here code if($error==false) { $query

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.