+ 1
Static methods are called by the class name a dot followed by the method name for example Calculation.add(2,4);
But sometime it also works without the class name for example System.out.println(add(2,4)); Why please somebody explain.
1 Respuesta
+ 4
you'll need the class name if the method are called from another class.
but if its called from the same class, its fine to not to include the class name.