class Principal {
public static void main(String[] args) {
Scanner entrada = new Scanner(System.in);
ArrayList colecao = new ArrayList();
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 2; j++) {
System.out.println("Insira um nome.");
colecao.add(entrada.next());
}
} for (Object resolucao:colecao) {
String formato = "| %-15s | %-10s |%n";
System.out.format("+---------------+----------+%n");
System.out.printf("| Nome | Nome 2 |%n");
System.out.format("+---------------+----------+%n");
System.out.format(formato, resolucao, resolucao + "%n");
System.out.format("+---------------+----------+%n");
}
}
}
I need to display separately using a for-each and that's where the problem is, how to display the right item in the right column?