Computer Science, asked by ThakurPriyanshuSingh, 1 year ago

when we run a program, the function is called first

Answers

Answered by Rajdeep11111
0
HOLA amigo!!
Rajdeep here.....

Any problem in JAVA?
Just ask me :)

So, now, to answer your question:
The function (member method) which is declared static is called first during runtime (execution).

Now, what is a static member method?
A member method is static which can handle static variables.

Static variables are the variables which are global to the whole class, and only a single copy of them is available for all methods and objects of the class.

For example.....
When you declare the main method, you write it as:

public static void main (String args[])

You are using the access specifier publicand since there is nothing to return, we use the keyword void. We declare the method as static so that during execution of the program, this main() method is executed first.

Hope my answer is satisfactory...
Thanks!! (^_^)
Similar questions