I am working on condensing my code for a project. Is there a way to print multiple primative types of arrays with the same method? I know you can with using "Object" but these are primative. Should I change them to Integer, Double, Boolean, etc and do it that way?
public void printArray(int []a){
for(int i = 0;i<a.length;i++)
System.out.print(a[i] + " ");
System.out.println("");
}
public void printArray2(boolean []a){
for(int i = 0;i<a.length;i++)
System.out.print(a[i] + " ");
System.out.println("");
}
public void printArray3(double []a){
for(int i = 0;i<a.length;i++)
System.out.print(a[i] + " ");
System.out.println("");
}