This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

calling a method repeatedly  RSS feed

 
Prionsios Mac Giollacom�in
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if I have a method, that is void and takes in nothing.
what is the easiest way to call it say 200 times? Would a normal loop work?

i.e.
.
.
call myMethod 200 times
.
.
.
public void myMethod()
{
/* do stuff */
}
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Prionsios Mac Giollacom�in:
if I have a method, that is void and takes in nothing.
what is the easiest way to call it say 200 times? Would a normal loop work?


Why not try that?
 
Kj Reddy
Ranch Hand
Posts: 1704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Prionsios Mac Giollacom�in:
Would a normal loop work?



Why not?
 
Prionsios Mac Giollacom�in
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, it works fine.
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps JavaRanch should make some stickers available that people can stick to the edge of their monitors that say things like "Why not try it and see" or "Have you googled first" or "Did you check in the API"?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!