Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Bear Bibeault
  • Liutauras Vilda
  • Devaka Cooray
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

A Very Tough Question from JDiscuss

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone give the output for this code without actually compiling & running ? This is a question from JDiscuss Test 4 with a little twist.

[ July 07, 2005: Message edited by: Barry Gaunt ]
 
Ranch Hand
Posts: 657
Spring VI Editor Clojure
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Can someone give the output for this code without actually compiling & running ?

My first reaction is that actually compiling and running it won't help either. Not only should you not depend on the thread scheduler for behavior, you won't see this type of question on the SCJP.

Furthermore, it seems a little pointless to ask others to give you the output of the code. Do you have a question about it? Is it doing something you don't expect?

<EDIT>
In case I wasn't clear about "running won't help" - there's no way to know what the output of that code will be. It can vary from one run to the next.
[ July 06, 2005: Message edited by: Steve Morrow ]
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please use tags around code to preserve its formatting.
 
I can't beleive you just said that. Now I need to calm down with this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!