Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java fill two dimensional array

//this way u can fill your array row by row

Scanner input = new Scanner(System.in);
for (int i = 0; i < row; i++){
	for (int j = 0; j < column; j++){
        array[i][j] = input.nextInt();
	}
}

//this way u can fill your array column by column
//Scanner input = new Scanner(System.in);
for (int i = 0; i < column; i++){
	for (int j = 0; j < row; j++){
        array[i][j] = input.nextInt();
	}
}
Comment

fill two dimension array java

//this way u can fill your array row by row

Scanner input = new Scanner(System.in);
for (int i = 0; i < row; i++){
	for (int j = 0; j < column; j++){
        array[i][j] = input.nextInt();
	}
}

//this way u can fill your array column by column
//Scanner input = new Scanner(System.in);
for (int i = 0; i < column; i++){
	for (int j = 0; j < row; j++){
        array[i][j] = input.nextInt();
	}
}
Comment

PREVIOUS NEXT
Code Example
Java :: convert text file into binnary format bitmap using java 
Java :: java hashset api 
Java :: Double matrix 
Java :: LayerRenderer 
Java :: jdk 17 not showing in update alternatives 
Java :: convert kotlin to java online editor 
Java :: newinstance in java giving exception 
Java :: what is abstract class 
Java :: Java List Replace at Index using set() function 
Java :: java max array 
Java :: how to find last element in array java 
Java :: polymorphism vs overriding in java 
Java :: java find duplicates in array 
Java :: string.replace in java 
Java :: call activity method from adapter 
Java :: how to get stack trace of a function in java 
Java :: java generate random string and number 
Java :: how to add a number to the ascii value of a char in java 
Java :: remove java ubuntu 20.04 
Java :: ArrayIndexOutOfBoundsException 
Java :: ejercicios resueltos de python codeskulptor 
Java :: how to make character in jframe 
Sql :: mysql create user with mysql_native_password 
Sql :: mysql get table size 
Sql :: safe update mode in mysql 
Sql :: mysql force query to use index 
Sql :: mysql get column names from table 
Sql :: SQLSTATE[HY000] [1049] Unknown database 
Sql :: restart postgresql.service Failed to restart postgresql.service: Unit not found. 
Sql :: fetch first 10 rows in oracle sql developer 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =