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.

7/2/2019 7:42:19 AM

stephen haokip

1 Answer

New Answer


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.