Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

fill two dimensional array columns by columns 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 :: fill two dimensional array 
Java :: resize image icon to fit jlabel 
Java :: export java_home linux 
Java :: android application class manifest 
Java :: java convert array to list 
Java :: java string static arrat 
Java :: how to find the length of a string in java without using length function 
Java :: enum set in java 
Java :: how to get current date in java 
Java :: java print pdf to printer 
Java :: java string to double comma 
Java :: how to find max in min in an array 
Java :: java initialize string array 
Java :: param query spring boot 
Java :: android xml change button background 
Java :: Cause: zip END header not found 
Java :: Java push() Method 
Java :: java replace element in list 
Java :: printing multiple variables in java 
Java :: java hello word 
Java :: Access items from the ArrayList using get() function 
Java :: java reverse string 
Java :: linkedhashmap in java 
Java :: android textview center align text programmatically 
Java :: string array to stringbuilder array java 
Java :: how to make a dictionary in java 
Java :: cardview implementation 
Java :: how to create a gui in java 
Java :: how to turna date into a LocalDateTime java 
Java :: rider find and replace 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =