First java will not allow you to have do()
method. Instead you can make it doOperation()
.
Second You cann't invoke directly non static methods from static function. Main
is a static function. You need to instantiate the class first and then invoke method using that instance.
Third you can invoke static method directly from non static methods.