Argument to main method ?

Why is the first argument is a String array in main method?... Why it could only be String ? why cann't it be anything else .. say array of int..Why VM specs require it to be String only ?
[203 byte] By [Shebua] at [2007-11-27 9:05:09]
# 1

OK lets say the arg to main was an array of ints. Then how would I execute a program that needed some String values as parameters?

If it is an array of Strings and your program needed ints as parameters, you can always parseInt the String values in the array.

Somebody else will probably be able to pull something out of the JLS that explains it.

floundera at 2007-7-12 21:39:01 > top of Java-index,Java Essentials,Java Programming...
# 2
paragraph 12.1.4 of the 3rd edition defines the method signature for a main method.
jwentinga at 2007-7-12 21:39:01 > top of Java-index,Java Essentials,Java Programming...
# 3
It's simple.Pleaz tell me the parameters' type:java -classpath . test.Main "your name" 18 1980-6-28 "Washington DC"
Stone.lia at 2007-7-12 21:39:01 > top of Java-index,Java Essentials,Java Programming...
# 4
They are all Strings. What's your point?
floundera at 2007-7-12 21:39:01 > top of Java-index,Java Essentials,Java Programming...
# 5
for Mr. flounderMy reply asks the topic owner named Shebu. I agree with the main define of JavaMessage was edited by: Stone.li
Stone.lia at 2007-7-12 21:39:01 > top of Java-index,Java Essentials,Java Programming...
# 6
They're strings because they are populated from text passed in via the command-line. The command-line has no concept of different data types, it reads everything as a stream of characters. It's up to individual programs to decide what to treat that data as
georgemca at 2007-7-12 21:39:01 > top of Java-index,Java Essentials,Java Programming...
# 7
thanks...
Shebua at 2007-7-12 21:39:01 > top of Java-index,Java Essentials,Java Programming...
# 8
thanks...
Shebua at 2007-7-12 21:39:01 > top of Java-index,Java Essentials,Java Programming...