Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Help Needed Regarding The Synchronization  RSS feed

 
Keerthi Kumar
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Please find the below piece of code which is of utility method and let me know whether this method needs to be synchronized or not?

public static int addNumbers(int a, int b)
{
return a+b;
}


Awaiting a positive response asap !

Thanks,
Keerthi Kumar N

 
Adam Smolnik
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is the thread-safe case. You don't share any state with other threads. So, you don't need any synchronization.

Adam
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!