Duncan Palmer
Duncan Palmer

Reputation: 2913

Does this count as single threaded?

For an assignment we have to show difference in time of execution between single thread and multithread. I was wondering if this counts as single thread, or if I actually have to call a new Thread object etc...

enter image description here

Upvotes: 1

Views: 87

Answers (2)

skyking
skyking

Reputation: 14360

Yes, you always have the main thread. Creating a new thread formally makes it multi-threaded (but for practical uses if the main thread only waits for the second thread to complete it can often be considered as single threaded).

Upvotes: 2

Molefe
Molefe

Reputation: 32

public class x {
    public static void main(String [] mainIsAThread) {
       system.out.println("hello world");
    }
}
//that is one thread

Upvotes: 1

Related Questions