What is the length of main's args in Java? is it dynamic? I want to pass parameters between two main methods, can I send any number of String arguments?
Asked
Active
Viewed 182 times
-2
-
Args between two main threads? Are you talking about two separate Java processes? – NPE Jan 05 '13 at 15:44
-
yes, in fact I'm facing an exception, and I thought it's about args length, thank you! – Curcuma_ Jan 05 '13 at 15:47
-
2I think you should post your code. – NPE Jan 05 '13 at 15:48
-
args is a String array and its length will be the number of parameters you will pass to it. – Achintya Jha Jan 05 '13 at 15:52
-
could someone explain to me why this question is down-voted? – Curcuma_ Feb 01 '14 at 21:59
2 Answers
0
I came up with this conclusions:
- args as any arrays is static not dynamic, but it's length is determined at run-time, and this doesn't make it dynamic anyway.
- we can
pass
(notsend
) arguments to other main method as it's just like any other method, it doesn't create a new thread.
I was thinking that calling main method would run another thread, that was just somehow stupid.
it's just executed in the memory of the caller thread, if we want to pass variables between two thread, we can use sockets
Edit
After nearly 20 months, here I'm back to this thread again, to correct my misconceptions about Java language.

Curcuma_
- 851
- 2
- 12
- 37