I have a problem passing a multiple array to constructor. Can we actually do that or not?
public class First {
public String[] a;
public String[] b;
public First(String[] a, String[] b){
this.a=a;
this.b=b;
}
}
And the next code is where I'm using class First.
Scanner ss = new Scanner(System.in);
int x;
System.out.print("How many lines? ");
x = ss.nextInt();
for(int i=0; i<x; i++){
System.out.print("A: "); a[i]=ss.nextString();
System.out.print("B: "); b[i]=ss.nextString();
}
First ff= new First(a,b);
In NetBeans, there is no error, but I can't use it in another class.
I'd be thankful if you would help me.