Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

fill two dimensional array row by row 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 :: arraylist to int array conversion in java 
Java :: java array initialization 
Java :: how to convert int to string in java? 
Java :: empty set java 
Java :: formula to calculate area of a triangle java 
Java :: java time difference 
Java :: intellij 
Java :: sort a string array java 
Java :: create a list java 
Java :: useColorScheme returning light 
Java :: java stream get all max values 
Java :: how to fill a 2d array in java 
Java :: get string of radio button in android 
Java :: file append in java 
Java :: each character in string java 
Java :: switch case in android studio - java 
Java :: java class name to string 
Java :: which api is android 12 
Java :: print array 
Java :: java printf tab 
Java :: compare numbers in array in java 
Java :: load contents of file into string java 
Java :: stringbuffer in java 
Java :: reverseString 
Java :: regex pattern for valid logins 
Java :: how to count the number of occurrences of an element in a arraylist in java 
Java :: java read integer from text file into array scanner 
Java :: math.min java 
Java :: There is no client authentication. Try adding an appropriate authentication filter 
Java :: how to convert a string to char in java 
ADD CONTENT
Topic
Content
Source link
Name
9+1 =