• Post Reply Bookmark Topic Watch Topic
  • New Topic

Do something before quiting a loop  RSS feed

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys.

Please have a look on this peace of a code. My intention is to invoke an additional method in case for one of the statement is true (object != null). How can I invoke it from here before "return object" is executed?

 
Sheriff
Posts: 22846
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess you would just replace the comments by actual Java code which does what the comments say. Although there's a good chance that you haven't described your problem correctly. I say that because your "loop" isn't a loop at all, if you unconditionally break out of it after the first time through.
 
You Gin
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Paul, you're right. My question rised just because of my incorrect understanding of while loop. Thanks.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!