java - How to check if all arguments in method are of specific type? -
i have method takes variable amount of arguments:
public void test(object[] ... args) {}
how can check if all arguments double[]?
loop , make sure each object[] double[]. note cannot use primitive double here not object.
boolean alldoublearr = true; for(object[] o : args) { if(!(o instanceof double[])) { alldoublearr = false; break; } }
Comments
Post a Comment