简单的char型数组输出却总是不能实现

令|A|=n,|B|=m。编写一个程序,输出A到B上的所有关系。这是题目
import java.util.Scanner;


public class relationship {
static String[] A;
static String[] B;

public static void main(String args[]){
System.out.println("please input the number of the element fo the combination A ");
Scanner scanner=new Scanner(System.in);
int num=scanner.nextInt();
A=new String[num];
System.out.println("please input the element fo the combination A ");
for (int i=0;i<num;i++){
Scanner scannertemp=new Scanner(System.in);
A[i]= scannertemp.next();
}

System.out.println("please input the number of the element fo the combination B ");
Scanner scanner1=new Scanner(System.in);
int num1=scanner1.nextInt();
B=new String[num1];
System.out.println("please input the element fo the combination B ");
for (int i=0;i<num1;i++){
Scanner scannertemp1=new Scanner(System.in);
B[i]= scannertemp1.next();
}
System.out.print(""+A[0]+"\n");
relation(A,num,B,num1);


}
public static void relation(String[]A,int numA,String[]B,int numB){
for(int i=0;i<numA;i++){
for(int j=0;j<numB;j++){
System.out.println("("+A[i]+","+B[j]+")");
}
System.out.print("\n");
}
}
}

上面的程序中如果把A和B数组的类型改成char型 则无论如何都不能输出,我尝试过 System.out.print(" "+A[0]);
System.out.print(A[0]+" ");
两种方法都不能输出数组中的内容
那位仁兄指点一下?
还有大家觉得我这个代码有什么需要改进的情多多的提啊

你可能感兴趣的:(J#)