method (String ... var) what does this mean?

  • Follow


What does the three dots after string mean?I have a class that have a method itemLookup(ItemLookupRequest...request)I pass an ItemLookupRequest object to the method and it is wrong. Whatdoes the three dots mean?Thanks,
0
Reply Ming 11/21/2007 10:59:18 PM

Ming wrote:> What does the three dots after string mean?> > I have a class that have a method itemLookup(ItemLookupRequest...> request)> > I pass an ItemLookupRequest object to the method and it is wrong. What> does the three dots mean?> > Thanks,The three dots means its a varargs method, it can take zero or more ItemLookupRequest objects...By "it is wrong", do you mean it doesn't do what you expect, or that you get a compiler error?  Copy and paste the exact error you're getting.-- Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
0
Reply Daniel 11/21/2007 11:08:50 PM


Thanks for reply.

It is a compiler error

Thanks for reply.

Code snippet:

AmazonECS service = new AmazonECSQuery(accessKeyId, associateTag);
....
ItemLookupRequest request=new ItemLookupRequest();
....
ItemLookupResponse response = service.itemLookup(request);

Eclipse complains that

The method itemLookup(ItemLookupRequest...) in the type AmazonECS is
not applicable for the arguments (ItemLookupRequest)	Test/src/com/
amazon/webservices/test	AWSTest.java

Thanks,


On Nov 21, 3:08 pm, Daniel Pitts
<newsgroup.spamfil...@virtualinfinity.net> wrote:
> Ming wrote:
> > What does the three dots after string mean?
>
> > I have a class that have a method itemLookup(ItemLookupRequest...
> > request)
>
> > I pass an ItemLookupRequest object to the method and it is wrong. What
> > does the three dots mean?
>
> > Thanks,
>
> The three dots means its a varargs method, it can take zero or more
> ItemLookupRequest objects...
>
> By "it is wrong", do you mean it doesn't do what you expect, or that you
> get a compiler error?  Copy and paste the exact error you're getting.
>
> --
> Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>

0
Reply Ming 11/21/2007 11:14:15 PM

Ming wrote:
> On Nov 21, 3:08 pm, Daniel Pitts
> <newsgroup.spamfil...@virtualinfinity.net> wrote:
>> Ming wrote:
>>> What does the three dots after string mean?
>>> I have a class that have a method itemLookup(ItemLookupRequest...
>>> request)
>>> I pass an ItemLookupRequest object to the method and it is wrong. What
>>> does the three dots mean?
>>> Thanks,
>> The three dots means its a varargs method, it can take zero or more
>> ItemLookupRequest objects...
>>
>> By "it is wrong", do you mean it doesn't do what you expect, or that you
>> get a compiler error?  Copy and paste the exact error you're getting.
>>
>> --
>> Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
> Thanks for reply.
> 
> It is a compiler error
> 
> Thanks for reply.
> 
> Code snippet:
> 
> AmazonECS service = new AmazonECSQuery(accessKeyId, associateTag);
> ....
> ItemLookupRequest request=new ItemLookupRequest();
> ....
> ItemLookupResponse response = service.itemLookup(request);
> 
> Eclipse complains that
> 
> The method itemLookup(ItemLookupRequest...) in the type AmazonECS is
> not applicable for the arguments (ItemLookupRequest)	Test/src/com/
> amazon/webservices/test	AWSTest.java
> 
> Thanks,
> 
> 
Please don't top post in the future.

What version of Java are you using?  Try compiling it, and paste the 
*exact* message.



-- 
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
0
Reply Daniel 11/22/2007 12:07:48 AM

On Wed, 21 Nov 2007 14:59:18 -0800 (PST), Ming <minghuiyu@gmail.com>
wrote, quoted or indirectly quoted someone who said :

>I pass an ItemLookupRequest object to the method and it is wrong. What
>does the three dots mean?

see http://mindprod.com/jgloss/dotdotdot.html
-- 
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
0
Reply Roedy 11/22/2007 6:07:18 AM

Maybe your method is overloaded.

May you show the entire source?

Roedy Green ha escrito:
> On Wed, 21 Nov 2007 14:59:18 -0800 (PST), Ming <minghuiyu@gmail.com>
> wrote, quoted or indirectly quoted someone who said :
>
> >I pass an ItemLookupRequest object to the method and it is wrong. What
> >does the three dots mean?
>
> see http://mindprod.com/jgloss/dotdotdot.html
> --
> Roedy Green Canadian Mind Products
> The Java Glossary
> http://mindprod.com
0
Reply ricardorq85 11/22/2007 4:03:11 PM

5 Replies
259 Views

(page loaded in 0.088 seconds)

Similiar Articles:













7/11/2012 8:48:52 AM


Reply: