This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Java in General and the fly likes Variable argument (VARARGS) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Variable argument (VARARGS)" Watch "Variable argument (VARARGS)" New topic
Author

Variable argument (VARARGS)

anisha bhushan
Greenhorn

Joined: May 31, 2012
Posts: 2
i have an error in this program regarding vargs..actuallly two

Sir i dont knw why but its giving two errors. the same happens with any vargs program. i”m new to java programming so please help me out..
the two errors are:
HelloWorldVarargs.java:8: (identifier expected)
public static void test(int some, String… args)
HelloWorldVarargs.java:14: (identifier expected)
}
2 errors.
please help me out…
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1467
    
    6

Anisha,

What version of java do you have?


Swastik
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14114
    
  16

Welcome to the Ranch.

Your program looks perfectly ok. Varargs were new in Java 5. If you're using Java 1.4 or older then you cannot use varargs.

Check your Java compiler and runtime version with these commands:

java -version
javac -version


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
anisha bhushan
Greenhorn

Joined: May 31, 2012
Posts: 2
Thankyou.. i have an older version of java and the program is running perfectly on eclipse. thanks for your response. sorry to bother you..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Variable argument (VARARGS)