Displaying arrays as a table
How do I display 5 arrays as a table?
Code:
import javax.swing.*;
public class Virus
{
public static void main(String[] args)
{
char [][] studentsGrid = {{'|','o','|','*','|','o','|','o','|','o','|'},
{'|','o','|','o','|','o','|','o','|','o','|'},
{'|','o','|','o','|','o','|','o','|','o','|'},
{'|','o','|','o','|','o','|','o','|','o','|'},
{'|','o','|','o','|','o','|','o','|','o','|'}};
//studentsGrid[0].length;
System.out.println("Day 1");
for (int r = 0; r<studentsGrid.length; r++)
{
for (int c=0; c<studentsGrid[r].length; c++)
//System.out.println(studentsGrid[r][c]);
System.out.print(studentsGrid[r][c] + "");
}
}
}
I hope I posted the code correctly. The grid simulates students in a class room and I need to show 8 different days how students are infected w/ spring fever. So lost.