-
help!!!
Code:
public boolean magic()
{
if ((sumMainDiag())==sumOtherDiag())
{
int sumRow=0;
int sumCol=0;
int row=0;
int col=0;
for(int t =0; t<(square.length); t++)
{
sumRow += square[row][t];
sumCol += square[t][col];
if (sumRow ==sumCol)
{
boolean magic = true;
}
else {
boolean magic = false;
}
}
}
else{
boolean magic= false;
}
}
there is a missing return statement error and its highlighting the last brace in red when i compile
-
Re: help!!!
Well, where do you return anything? i.e., where is there a statement that starts
I think you'll want to read up on how to create methods and return values from them. Please have a look here:
Defining Methods
Returning a Value from a Method
-
Re: help!!!
And also please use the code tags when you are posting code segments here in the forum. Unformatted codes are really hard to read.