Answers for "new thrad java"

0

start thread java

package com.tutorialspoint;

import java.lang.*;

public class ThreadDemo implements Runnable {

   Thread t;
   ThreadDemo() {
    
      // thread created
      t = new Thread(this, "Admin Thread");
     
      // prints thread created
      System.out.println("thread  = " + t);
      
      // this will call run() function
      System.out.println("Calling run() function... ");
      t.start();
   }

   public void run() {
      System.out.println("Inside run()function");
   }

   public static void main(String args[]) {
      new ThreadDemo();
   }
}
Posted by: Guest on April-09-2020
1

new thrad java

Thread thread = new Thread(){
    public void run(){
      System.out.println("Thread Running");
    }
  };

  thread.start();
Posted by: Guest on August-02-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language