Need to use public,static keywords in main function?

Answer Posted / psreddy

public access modifier we declared then that class visible
to every where and access to any where
bcoz if we write any number business logic classes but
we have to write only one execution logic class for all
these business logic classes
that is why always execution logic class as public
and also there is need of writing static key word
bcoz the execution logic executes only once
other wise we will get runtime exeption

Is This Answer Correct ?    5 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why do we use threads in java?

659


Does java allow overriding static methods ?

732


how can you catch multiple exceptions in java?

631


When should you use arraylist and when should you use linkedlist?

575


What is floor math?

595






What is the functionality of the stub?

670


Does apple use java?

596


Give the hierarchy of inputstream and outputstream classes.

699


Explain the hierarchy of java exception classes?

698


How to find the largest value from the given array.

618


Why java does not support pointers?

662


What best practices should you follow while writing multithreaded code in java?

647


Can a class have multiple subclasses?

686


Explain 5 io best practices?

686


What is java thread dump, how can we get java thread dump of a program?

666