Bajarilishni boshqarish operatorlari(sindirish, qaytish) - break []
- Misol:
- for (…) {
- …
- break;
- …
- }
- label:
- for (…) {
- …
- break label
- …
- }
- return;
Massiv - []
- Misol:
- int[] a;
- byte[] b = new byte[100];
- String c[];
- byte d[] = new byte[100];
- a = {4, 2, 12, 5, 5, 20}; // a[0]: 4; a[2]: 12;
- с = new String[]{“bir”, “ikki”, “uch”}; // c[2]:”uch”
- int[] i = a; // i[2]: 12
- i[4]=24; // a[4]: 24
- Int[] arr = {10, 11, 12, 20, 40, 50, 60, 70, 80, 90, 100};
- System.arraycopy(I, 2, arr, 4, 4);
- //arr: 10, 11, 12, 20, 12, 5, 24, 20, 80, 90, 100
Ko’p o’lchovli massiv - char [] row0 = {‘A’, ‘B’, ‘C’, ‘D’};
- char [] row1 = {‘E’, ‘F’, ‘G’, ‘H’};
- char [] row2 = {‘I’, ‘J’, ‘K’, ‘L’};
- char [] row3 = {‘M’, ‘N’, ‘O’, ‘P’};
- ------------------------------------------
- char [] [] table = new char[4][4];
- table[0] = row0;
- table[1] = row1;
- table[2] = row2;
- table[3] = row3;
- ------------------------------------------
- char [] [] table = {row1, row2, row3, row4};
- ------------------------------------------
- char [] [] table = {
- {‘A’, ‘B’, ‘C’, ‘D’},
- {‘E’, ‘F’, ‘G’, ‘H’},
- {‘I’, ‘J’, ‘K’, ‘L’},
- {‘M’, ‘N’, ‘O’, ‘P’}
- };
To’g’ri to’rtburchaksimon bo’lmagan massiv - String[] [] imtihon = new String[4][];
- imtihon[0] = new String[] {“Algebra”,“Analiz”, “Geometriya”};
- imtihon[1] = new String[] {“Differentsial tenaglamalar”, “Mantiq”};
- imtihon[2] = new String[] {“Informatika”, “Funktsinal analiz”, “Topologiya”, “Diskret matematika”};
- imtihon[3] = new String[] {“Dasturlash texnologiyalari”, “Maxsus kurs”};
- int[][][] intArr = new int[3][][];
- intArr[0] = new int[2][]; intArr[1] = new int[4][]; intArr[2] = new int[2][];
- intArr[0][0] = new int[10]; intArr[0][1] = new int[12];
- intArr[1][0] = new int[8];
- intArr[1][1] = new int[3];
- intArr[1][2] = new int[10];
- intArr[1][3] = new int[2];
- intArr[2][0] = new int[5];
- intArr[2][1] = new int[9];
- intArr[1][3][0] = 24;
|