In Java why we write public static void main(String args[])
why not main()?
Answer Posted / b.prasad
1.we should give public bcoz the main() used my all
applications that r out side of application
2.we should give static bcoz it is instance method.so that
with out creating an object we can call it directly.and the
definition of the method should not been changed
3.we should give void bcoz the main() does not return any
value.ie void means return nothing
4.we should give args[],bcoz the main method takes some
arguments in the command prompt that are the string type and
also the jvm defines the signature of the main() is like that
| Is This Answer Correct ? | 3 Yes | 1 No |
Post New Answer View All Answers
Write a java program to count the number of words present in a string?
How do you remove all elements from an arraylist in java?
Explain about oops concepts.
What is the functionability stubs and skeletons?
What does int argc char * argv [] mean?
What does java se mean?
Write a program to solve producer consumer problem in java?
Tell me a few examples of final classes defined in Java API?
What does method mean?
Is arraylist a class in java?
What is natural ordering in java?
Why pointers are not used in java?
How can I right-justify a string?
What is var keyword ?
How is Object Oriented Programming different from Procedure Oriented Programming?