• Post Reply Bookmark Topic Watch Topic
  • New Topic

System Thread  RSS feed

 
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
we all know that the main method is first called when a java application is executed. To execute that i believe a Thread is been created by jvm assumably called as System Thread,which executes the main method. Going by assuming this concept,how does the following code produces o/p as 6793



help appreciated
cheers
amal shah
 
author
Sheriff
Posts: 23513
138
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

how does the following code produces o/p as 6793



The "6" is printed when the test class is loaded, obviously before the main() method is called.

The "7" is printed by line one of the main() method.

The "9" is printed by line three of the main() method.

The "3" is printed by the constructor, when a test object is created by line four of the main() method.

Henry
 
Destiny's powerful hand has made the bed of my future. And this tiny ad:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!