In Java why we write public static void main(String args[])
why not main()?
Answer Posted / sivadasan
1. public - Access Specifier, properties and methods can
access anywhere, any package.
2. main() - The Java environment starts the execution of a
program from main() method.
3. void - The main() method is not return anything. So the
return type of the main() method must be void.
4. static - The jave environment able to call the main()
method without creating an instance of the class. So its
declared as static
5...(String args[]) -- In java, whatever we give, it will
takes as String. So we are giving the command line argumet
as String.
i hope it will help u..
Shivadasan
Coromandel Infotech
| Is This Answer Correct ? | 16 Yes | 4 No |
Post New Answer View All Answers
How do you trim a space in java?
Is it possible to compare various strings with the help of == operator? What are the risks involved?
Which collections are thread safe in java?
Can we convert stringbuilder to string in java?
What is parsing in grammar?
What is a default method?
What are alternatives to java serialization?
Why hashmap is used in java?
Given a singly linked list, determine whether it contains a loop or not without using temporary space?
Why heap memory is called heap?
Can an interface have a class?
What is substring 1 in java?
what is singleton in java?
What is an interface in java?
What does system.gc() and runtime.gc() methods do?