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

How is string immutable in java?

544


What are the special characters?

538


What is java abstraction with example?

559


What is difference between iterator and enumeration in java?

527


What is java literals?

580






How can you traverse a linked list in java?

685


Can we able to pass objects as an arguments in java?

535


what is meant by encapsulation?

629


Write a java program to generate fibonacci series ?

574


What is a consumer in java?

570


What is the main functionality of the remote reference layer?

1415


What is the purpose of void class?

611


What is the best definition for data?

523


What is the difference between error and an exception?

570


Explain about the dynamic behavior of core java?

636