aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes different main method arguments Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "different main method arguments" Watch "different main method arguments" New topic
Author

different main method arguments

Arjun Srivastava
Ranch Hand

Joined: Jun 23, 2010
Posts: 432



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: 14687
    
  16

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: 432


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: 432

thanks all i got it.
there is nothing like String... var[]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: different main method arguments