i can't undestanding this why the main function in java is static and static function can call using class name. And why we declare main function as public. i can not understanding this procedure of main function in java. plz help me.
first of all: java doesn't have functions, it has methods. yes, there is a difference.
the main method has to be static, since it is the entry point of the application, the very first thing that runs.
if it wasn't static, you would need an instance of the class to call it on, but how can you have an instance if your application isn't running yet?
we declare it public, so we will be able to call it from "anywhere", since that is what we need to do. we're not yet in the running application, which means that package, protected, and most importantly, private scopes would make the method unaccessible.