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

Answer Posted / ankit

public is written so that it can be called from outside and
static is written because main is called before the creation
of any object and for static methods object is not required.

Is This Answer Correct ?    1 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the purpose of static methods and static variables?

544


What is boolean flag in java?

580


In which language java is written?

542


Name and explain the types of ways which are used to pass arguments in any function in java.

575


design an lru cache in java?

546






What is difference between an object and a class?

615


What exactly is java?

519


What is a pattern what is an anti pattern?

512


What are the types of collections in java?

541


What is complexity and its types?

528


What is tree node in java?

530


What is the difference between heap and stack memory?

548


What is hotjava?

561


What is the intersection and union methods?

550


What are the 4 types of characters?

546