/
NikolayIvkin
/
JavaExercises1
Обзор
Документация
Войти
/
NikolayIvkin
/
JavaExercises1
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
Test/ArrayDemo.java
107 строк
3 KB
germa
Преобразование в один проект
28 ноя 2024, 08:51
28 ноя 2024, 08:51
88ea6ff
Код
Авторство
О чём код?
package Test; import java.io.IOException; public class ArrayDemo { public static void main(String[] args) throws IOException { /* int[] arr = new int[10]; int min,max; arr[0] = 10; arr[1] = 20; arr[2] = 30; arr[3] = 40; arr[4] = 50; arr[5] = 60; arr[6] = 70; arr[7] = 80; arr[8] = 90; arr[9] = 100; min = max = arr[0]; for(int i = 0; i<arr.length;i++){ if(arr[i] < min) { min = arr[i]; } if(arr[i] > max){ max = arr[i]; } } System.out.printf("Min: %d, Max: %d", min, max);*/ /* int[][] arr = new int [5][5]; for(int i = 0; i<5;i++){ for(int j = 0; j<5;j++){ arr[i][j] = i + j; System.out.print(arr[i][j] + " "); } System.out.println(); }*/ char choice; do{ System.out.println(""" Short reference about: 1. if 2. switch 3. while 4. do while 5. for Choose your variant:"""); choice = (char) System.in.read(); }while (choice < '1' || choice > '5'); System.out.println(); switch (choice){ case '1': System.out.println(""" Operator if if(condition){operator} else operator"""); break; case '2': System.out.println(""" Operator switch switch(variable){ case value: operator break;"""); break; case '3': System.out.println(""" Operator while while(condition){ operator }"""); break; case '4': System.out.println(""" Operator do while do{ operator"""); break; case '5': System.out.println(""" Operator for for(initialization; condition; increment){ operator"""); break; } } }