| Author |
different main method arguments
|
Arjun Srivastava
Ranch Hand
Joined: Jun 23, 2010
Posts: 431
|
|
line1 compiles fine.
line 2 shows error.
please specify the difference between line1 and line2.
|
SCJP 6 | FB : Java Certifications-Help. | India Against Corruption
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14685
|
|
The notation for variable arguments is "T... var", where T is the type of the variable arguments. To pass several String arrays, you can only use "String[]... var", not "String... var[]".
|
[My Blog]
All roads lead to JavaRanch
|
 |
Arjun Srivastava
Ranch Hand
Joined: Jun 23, 2010
Posts: 431
|
|
thanks for the reply.
|
 |
Seetharaman Venkatasamy
Ranch Hand
Joined: Jan 28, 2008
Posts: 5575
|
|
Arjun Srivastava wrote:
syntax error . and you cant use [] with reference variable after ... in var-arg syntax.
and compiler interpret this as
<edit>Christophe Verré beaten me</edit>
|
 |
Abimaran Kugathasan
Ranch Hand
Joined: Nov 04, 2009
Posts: 2066
|
|
Arjun Srivastava wrote:
line1 compiles fine.
line 2 shows error.
please specify the difference between line1 and line2.
What do you mean by line2. Line 1 means, variable arguments method signature! And, you can specify n-D array there. But, what is you line2?
|
|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
|
 |
Arjun Srivastava
Ranch Hand
Joined: Jun 23, 2010
Posts: 431
|
|
thanks all i got it.
there is nothing like String... var[]
|
 |
 |
|
|
subject: different main method arguments
|
|
|