Привет, я новичок в java, так как вы можете видеть из кода. что я хочу, чтобы он заполнил массив одним методом, а затем во втором методе я хочу отобразить этот массив.Передача 2d массива для печати в java
public class Rulebase {
String[][] array()
{
String[][] table = new String[3][4];
table[0][0]="1";
table[0][1]="person(?x),patientid(?y),hasid(?x,?y)";
table[0][2]="patient(?x)";
table[0][3]="1";
table[1][0]="1";
table[1][1]="patient(?x),hasbp(?x,high)";
table[1][2]="hassituation(?x,emergency)";
table[1][3]="1";
table[2][0]="1";
table[2][1]="hassituation(?x,emergency)";
table[2][2]="calldr(emergency)";
table[2][3]="1";
return table;
}
void showarray(String[][] table)
{
for(int i=0;i<4;i++)
for(int j=0;j<4;j++)
{
System.out.println(table[i][j]);
}
}
public static void main(String[] args) {
Rulebase rb = new Rulebase();
rb.array();
rb.showarray();
// TODO code application logic here
}
}
совет требуется пожалуйста.
hahahah это сработало, спасибо @Ramanlfc –