26
In Scala there are two ways to define a method which takes no argument
1 def a=println("hello")
2 def a()=println("hello")
These two methods are exactly same but (2) can be called with and without parentheses.
Is there any special reason for which this feature is allowed in Scala.It confuses me which to use and when?