Why do we use public static with the main function in Java?

Answer Posted / rameshreddy.k

As we know public means we can access the method from
anywhere. in a java we want call method by using class
object. But main() is also method .that main() is there one
class but jVM execute program trough main() method with out
creating object main() method call thats way we use public
static the main function
thanks& regargs
RAMESH

Is This Answer Correct ?    4 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is stack example?

615


Why we use protected in java?

596


What is getclass () getname () in java?

729


23. Storage space in java is of the form Stack Queue Heap List 24. What is java code embedded in a web page known as Applets Servlets scriptlets snippets 25. Which of the following attributes are compulsory with an tag?. code,height & width. 26. What does 'CODEBASE' in an applet tag specify?. Files absolute path.

2122


What is class array in java?

567






What is the use of using enum to declare a constant?

614


How do you convert string to int in java?

611


What are the differences between getting and load method?

595


What is the loop in java?

645


what is method reference in java 8?

620


Describe the syntax of multiple inheritance? When do we use such an inheritance?

652


Explain importance of throws keyword in java?

627


Which class contains a method: cloneable or object?

598


What is the most important feature of java? What is an interface?

574


What type of value does sizeof return?

600