I can't hand over "vec" to another function. Why? I mean the other function is already static tho ...
import java.util.*;
public class Vector2 {
public static void method(vec) {
for(int i=0; i<vec.size(); i )
System.out.println(vec.get(i));
}
public static void main(String[] args) {
Vector<String> vec = new Vector<String>();
vec.add("one");
vec.add("two");
method(vec);
}
}
Error message:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The method method() in the type Vector2 is not applicable for the arguments (Vector<String>)
at Vector2.main(Vector2.java:14)
CodePudding user response:
method
's argument is missing a type. It should be:
public static void method(Vector<String> vec)