How many threads being created?

In one of the interview i came across query on threads.Question is in the below code snippet, how many threads are being created? I know it's seems to be very basic query. But i couldn't find answer with proof.

Could someone provide me answer with the concept(any links)? Thanks in anticipation.

class MainApp {
    public static void main(String[] args) {
        System.out.println("Welcome to Java");
    }
}

Answers


Since your simple program does not create threads explicitly only one application thread is created here. This is the "correct" short answer at the interview.

However you can continue and say that JVM creates other threads it needs for itself. For example garbage collector (GC) thread. Number of GC threads depends on configuration. By default 1.


Need Your Help

TXT or CSV to C++ Map

c++ csv text map

I'm looking for the best/simplest way to take data from a txt file I have and incorporate that data into a map container in C++. I have a two-dimensional txt file with all unsigned integers intege...

How to customize workflow task forms in InfoPath Designer 2010

sharepoint-designer sharepoint-workflow infopath2010

I have a Sharepoint 2010 site. It contains a list. I have created a workflow that triggers when an item is added in that list. The workflow will start a Feedback process on the Current Item with some

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.