0
whats the problem?
import java.util.*; public class Main { public static void main(String[] args){ //i = rows , j = colomns char[][] c = { {'a' , 'b'} , {'c' , 'd'} , {'e' , 'f'} }; for (int i = 0; i < 2; i++){ for (int j = 0; j < 3; j++){ System.out.print(c[i][j]); } System.out.println(""); } } }
2 Réponses
+ 3
Your array consists of three rows with two columns for each row. So in your nested loop you need to swap the final value for <i> and <j>
for(int i = 0; i < 3; i++)
for(int j = 0; j < 2; j++)
Something like that ...
+ 1
Ipang thanks, I thought it was the other way around...