Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Variable argument (VARARGS)

 
anisha bhushan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1604
5
Android Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anisha,

What version of java do you have?
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15282
39
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
anisha bhushan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thankyou.. i have an older version of java and the program is running perfectly on eclipse. thanks for your response. sorry to bother you..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic