• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

thread question

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi guys:
one of my friend ask this question to me please give me the answer of this question and explanation
thax
// When matchXY method will retrurn true?
 
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't see any relevance of this question to threads..... are the methods supposed to be synchronized?
as it stands, the program returns true when run, without calling setXY(). the static variables x and y are set to their default values of 0.
since you are only calling matchXY(), then both x and y are equal so it returns true!
am I missing something here
[ July 13, 2002: Message edited by: Amir Ghahrai ]
[ July 13, 2002: Message edited by: Amir Ghahrai ]
[ July 13, 2002: Message edited by: Amir Ghahrai ]
 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Shoba,
i totally agree with Amir. you might want to go through the code again and check if you have missed something....as your question pertaining to threads , seems no relevance here with this particular code snippet...therefore it comes across as a question , about static variables being initialised to 0 , hence being equal , when the method matchXY() is called , which in turn returns true !!!
 
reply
    Bookmark Topic Watch Topic
  • New Topic