Johanna
Johanna

Reputation: 27660

what is the value for main thread priority?

all threads have its priority,so what is the integer value for main thread?

Upvotes: 5

Views: 11499

Answers (3)

Jack Leow
Jack Leow

Reputation: 22487

If you still have any doubts, have a look at the JDK's API docs:

From http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Thread.html#NORM_PRIORITY:

NORM_PRIORITY

public static final int NORM_PRIORITY

    The default priority that is assigned to a thread.

From http://java.sun.com/j2se/1.5.0/docs/api/constant-values.html#java.lang.Thread.NORM_PRIORITY:

static final int NORM_PRIORITY 5

Upvotes: 4

OscarRyz
OscarRyz

Reputation: 199254

This code shows you the priority of the main thread:

public class Main {
    public static void main( String [] args ) {
        System.out.println( Thread.currentThread().getPriority() );
    }
}

The output, and the answer to your question, is 5.

Upvotes: 18

rajshri
rajshri

Reputation: 1

by default thread value is 6 .......

Upvotes: -4

Related Questions