Java Thread.run()

Syntax

Thread.run() has the following syntax.

public void run()

Example

In the following code shows how to use Thread.run() method.


/*from   w w w .ja va 2 s  . c  o  m*/
public class Main {
  public static void main(String args[]) {

    Thread t = new Thread(new ThreadDemo());

    System.out.println("thread  = " + t);
    t.start();
  }
}

class ThreadDemo implements Runnable {
  public void run() {
    System.out.println("Inside run()function");
  }
}




















Home »
  Java Tutorial »
    java.lang »




Boolean
Byte
Character
Class
Double
Enum
Float
Integer
Long
Math
Number
Object
Package
Process
ProcessBuilder
Runnable
Runtime
SecurityManager
Short
StackTraceElement
StrictMath
String
StringBuffer
StringBuilder
System
Thread
ThreadGroup
ThreadLocal
Throwable