“Membaca Array 2D di Java” Kode Jawaban

cara mencetak array 2D di java

for (int row = 0; row < arr.length; row++)//Cycles through rows
{
  for (int col = 0; col < arr[row].length; col++)//Cycles through columns
  {
    System.out.printf("%5d", arr[row][col]); //change the %5d to however much space you want
  }
  System.out.println(); //Makes a new row
}
//This allows you to print the array as matrix
GelatinousMustard

Cetak Array 2D di Java

int[][] array = new int[rows][columns];
System.out.println(Arrays.deepToString(array));
Careful Cockroach

Membaca Array 2D di Java


public class Sample {
    public static void main(String[] args) {

        String names[][] = {
                { "jasmine", "jasmine123" },
                { "lyka", "lyka123" },
                { "marbie", "marbie123" }
        };
        System.out.println(names[1][0]);
    }
}
Fernandez, Jasmine M.

Jawaban yang mirip dengan “Membaca Array 2D di Java”

Pertanyaan yang mirip dengan “Membaca Array 2D di Java”

Lebih banyak jawaban terkait untuk “Membaca Array 2D di Java” di Java

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya