Groovy Default Parameters

def someMethod(parameter1, parameter2 = 0, parameter3 = 0) {
   // Method code goes here
}


class Example {
   static void sum(int a,int b = 5) {
      int c = a+b;
      println(c);
   }

   static void main(String[] args) {
      sum(6);
   }
}



Comments

Popular posts from this blog

தட்டு வண்டியில் காளிக்கோயில் - சிறுகதை

பிரேமாவின் பெண் குழந்தை

தீபம் பிளக்ஸ்