in the first example, foo is a constructor method, its like a “static” method in java. Secondly, it’s like defining a foo method for a class - it is bound to an instance.
would you gain access to the first as
Date.foo()
and second -
Date d = new Date()
d.foo()
or in another Date instance method, for example
this.foo()
source
share