我想存储想要使用我的java程序测试的不同测试用例的输入。 在示例输入下面:
Get-AzureSqlDatabase
下面:
我的问题是,如何在运行时存储所有这些元素,并将它们作为输入提供给我的java类。
答案 0 :(得分:0)
/*
* Sharing the code here with . Yes,there will be multiple test cases in
* the input Suggest any better way if you find
*/
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int testcases = Integer.parseInt(br.readLine());
String readinput = "";
int count = 0;
int[][][] array = new int[testcases][3][];
for (int i = 0; i <= array.length; i++) {
readinput = "";
count = 0;
for (int j = 0; j < array[i].length; j++) {
readinput = br.readLine();
count = readinput.split(" ").length;
String[] data = new String[count];
data = readinput.split(" ");
System.out.println(Arrays.toString(data));
for (int k = 0; k < count; k++) {
array[i][j][k] = Integer.parseInt(data[k]);
}
}
}