How to take input

Is it a string or character by character input
i

take it like this:

char[][] g = new char[n][m];
	for (int i = 0; i < n; i++) {
		String s = sc.next();
		for (int j = 0; j < m; j++) {
			g[i][j] = s.charAt(j);
		}
	}