Пацей 4 сем / Лекции / СТПI_1_введение
.pdfУпрощённый цикл
for (double x : aq){ System.out.println(x);
}
Многомерные массивы
Многомерных массивов не существует, но можно объявлять массив массивов
int[][] d = new int[3][4];
int[][] inds = {{1, 2, 3}, {4, 5, 6}};
Получает доступ по чтению ко всем элементам без использования индексов
Изменять значения элементов нельзя
char[][] c1; char[] c2[]; char c3[][];
c1 = new char[3][];
c1[0] = new char[2]; c1[1] = new char[4]; c1[2] = new char[3];
int c1Size= c1.length ;//3 c1Size=c1[0].length;// 2 c1Size= c1[1].length;//4 c1Size= c1[2].length; //3
Ввод
Scanner forIn = new Scanner(System.in); int somInt = forIn.nextInt();
String someStr3 = forIn.nextLine();
Console con= System.console(); con.reader();
con.readLine();
con.writer();