Results 1 to 3 of 3
- 01-17-2012, 03:15 AM #1
Member
- Join Date
- Jan 2012
- Posts
- 2
- Rep Power
- 0
help!!!
there is a missing return statement error and its highlighting the last brace in red when i compileJava 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; } }Last edited by Eranga; 01-17-2012 at 06:00 AM. Reason: code tags added
-
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:Java Code:return ....
Defining Methods
Returning a Value from a Method
- 01-17-2012, 06:01 AM #3
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
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.


1Likes
LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks