WHy the variable static is used in front of function:
int additionReturn(int a,int b) ?
Why used static in front of a function?
Hey @kavit Stating static means you dont need to initialize any object to use that variable or function. For eg :
additionReturn is static
Therefore you can directly call additionReturn from main method.
But if it was not static then you need to create a object of that class for eg : if your class name is Addition
then to use additionReturn function you have to write :
Addition add = new Addition();
add.additionReturn(a,b);
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.