onları daha iyi anlamak için yerlerinde ifadesini kırın
:
int[] first = new int[]{1}; // create a new array with one element (the element is the number one)
int[][] second = new int[][]{first}; // create an array of the arrays. The only element of the outer array is the array created in the previous step.
int[] third = second[0]; // retrieve the first (and only) element of the array of array `second`. This is the same again as `first`.
Şimdi yine o ifadeleri birleştirilecek. Önce first
ve second
birleştirme:
int[][] second = new int[][]{new int[]{1}};
int[] third = second[0];
Tamam, önemli değil. Ancak second
ifadesi kısa olabilir. Aşağıdaki eşdeğerdir: Şimdi ikinci ve üçüncü birleştiririz. Doğrudan yazabiliriz:
int[] third = new int[][]{{1}}[0];
Ve işte buradayız.
Genellikle yeni arkadaşlar edinmek istemeyen programcılar tarafından oluşturulur. – Maroun
İfade, geçerli bir java ifadesidir. Yani sanırım bu java hakkında ve java etiketini ekledi. Eğer Yanlışsam beni düzelt. – yankee