About Question enthuware.ocpjp.v8.2.1398 :
Moderator: admin
-
- Posts: 2
- Joined: Sat Jan 11, 2020 5:31 pm
- Contact:
About Question enthuware.ocpjp.v8.2.1398 :
Is the main method not creating a thread? In that case, '1 new thread is created' would be true, right?
-
- Site Admin
- Posts: 10065
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1398 :
No, main method is not creating a thread. Which line of code in main method do you think is creating a thread?
If you like our products and services, please help us by posting your review here.
-
- Posts: 2
- Joined: Sat Jan 11, 2020 5:31 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1398 :
Is starting the main method, not starting a thread?
'1 new thread is created by the code in this program.' seems somewhat ambiguous (what does 'creating' mean?)...
https://www.geeksforgeeks.org/main-thread-java/
'1 new thread is created by the code in this program.' seems somewhat ambiguous (what does 'creating' mean?)...
https://www.geeksforgeeks.org/main-thread-java/
-
- Site Admin
- Posts: 10065
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1398 :
"By the code in this program" is not ambiguous at all. The main thread that you are referring to is created by the JVM, and not by the code given in the program. To create a thread, you would have to use the Thread class either directly or indirectly.
If you like our products and services, please help us by posting your review here.
-
- Posts: 1
- Joined: Sat Jan 09, 2021 8:35 am
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1398 :
The Main Thread gets startet by the JVM as soon as you start your programm, than the main thread looks for the main method. The main Thread existsJoost86 wrote: ↑Sun Jan 12, 2020 6:05 amIs starting the main method, not starting a thread?
'1 new thread is created by the code in this program.' seems somewhat ambiguous (what does 'creating' mean?)...
https://www.geeksforgeeks.org/main-thread-java/
indepentent of the main method, so writing a main method has no impact of the number of threads.
-
- Posts: 2
- Joined: Fri Apr 28, 2023 6:45 am
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1398 :
Yeah i took this as ambiguous and if i were to run this from the command line the 'main' thread would start up i.e. 1 new thread. but I see how it's the other.
Who is online
Users browsing this forum: No registered users and 113 guests