java - Beginner Boolean compiling error -


i new java (doing beginners university module) sorry silly question. trying verify whether ragged array 'tridiagonal matrix'.

it valid if of length 3 @ first level , of length n − 1, n, , n − 1 @ second level. intended come code firstly verify length 3, find longest length array within n, verify each length.

for whatever reason code won't compile i'm not seeing error message, red exclamation mark on class. assume means there multiple errors. if point them out massive help.

static boolean isvalidtridiagonal ( double [][] m) {      if (double [][]=new double [3][])     {          int n = 0;         for(int = 0; < m.length; i++)         {             if(m[i].length > n)             {                 n = m[i].length;                  if( (m[0].length = n-1) && (m[1].length = n) &&(m[2].length=n-1))                 {                     return true                  }                 else                 {                     return false                 }             }                 else              {                 return false             }         } 

thanks much!

why need loops? if arrays cannot null, than

static boolean isvalidtridiagonal(double[][] m) { return m.length == 3 && m[0].length == m[1].length - 1 && m[2].length == m[0].length; }


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -