Click here to Skip to main content
15,894,540 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
public static void main(String[] args)

following are my questions about above code -

1) in above code what is meaning of "String".

2) in above code what is meaning of "[]".

3) in above code what is meaning of "args".

4) what if i do not include "String[] args".
Posted
Comments
[no name] 27-Jul-15 11:10am    
1. It means that that the datatype of args is a String.
2. That means that args is an array of Strings
3. args is a variable name
4. What if?
5. Get yourself a decent basic book on programming and work through it. You could have found the answers yourself if you had just put in a little bit of effort.
Sergey Alexandrovich Kryukov 27-Jul-15 11:12am    
The set of four questions is absurd. Learn what it is in general, that's it. Short answer would be: learn programming.
—SA
CPallini 27-Jul-15 11:27am    
What is Java?
Q&A cannot replace a book.
nihal saxena 27-Jul-15 11:51am    
sorry sir for a silly question

Please see: https://en.wikipedia.org/wiki/Entry_point#Java[^].

Any questions?

—SA
 
Share this answer
 
Comments
nihal saxena 28-Jul-15 8:17am    
thanks
Sergey Alexandrovich Kryukov 28-Jul-15 8:41am    
You are welcome. Will you accept this answer formally, too? It tells you all you need.
—SA
1) String : A "list" of characters. "This is a string". "So is this"
2) [] : Array. An array is a specific type of collection, like a chess board where each "square" can hold one piece at a time.

So "String[]" is an array of strings.

3) args : name of the variable that receives the array of strings.

In this case, it gets any parameters that were passed to the application when it was executed - input and output file names for example.

4) You won't be able to use any parameters that were supposed to be used to control how your program works.

This is relatively simple stuff - but it'll make sense later in your course. Ignore it for now, and your tutor will explain what an array is better than I could!
 
Share this answer
 
 
Share this answer
 
Comments
nihal saxena 28-Jul-15 8:17am    
thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900