java - How are 2D Multidimensional arrays populated? -


 scanner scan = new scanner(system.in);        double [][] dailytemperature;          double totaltracker = 0.0;         string [] daysofweek = { "monday ","tuesday ","wednsday ","thursday","friday ","saturday ","sunday "};          dailytemperature = new double[4][7];          ( int = 0; < dailytemperature.length; i++ )            ( int j = 0; j < dailytemperature[0].length; j++ )             {                 system.out.print( "enter " + daysofweek[j]+ "temperature week" + ( + 1 ) + "\t");                 dailytemperature[i][j] = scan.nextdouble( );              } 

so question confirm how 2d arrays populated, question inside nested loop increases 1 stay 1 until j counted 7 times , increment 1, or simultaneously increment?

just consider them stack. starting outer loop put stack execution go inside loop @ deepest level @ top. have complete work of topmost element or deepest level loop goes loop under it. analogy case. hope got idea.


Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -