What is the use of static keyword in "public static void
main()"

Answer Posted / rasool

The public keyword is an access specifier, which allows the
programmer to control the visibility of class members. When
a class member is preceded by public, then that member may
be accessed by code outside the class in which it is
declared.In this case, main( ) must be declared as public,
since it must be called by code outside of its class when
the program is started. The keyword static allows main( ) to
be called without having to instantiate a particular
instance of the class.

Is This Answer Correct ?    2 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What type of variable is error flag?

834


What is the use of jtable?

861


Is namespace same as package in java?

750


What is the use of runnable interface?

850


Can a variable be local and static at the same time?

775


What is the core java?

731


What is the difference between synchronized and synchronized block?

805


What is the public field modifier?

772


In multi-threading how can we ensure that a resource isn't used by multiple threads simultaneously?

1099


Can a class have more than one object?

759


What does exclamation mean in java?

777


What are the library functions in java?

791


Explain about java sdk?

811


What is the transient keyword?

1348


Is java same as core java?

824