Results 1 to 4 of 4
Thread: you cant do var.length - 1?
- 03-15-2012, 08:48 PM #1
Member
- Join Date
- Mar 2012
- Posts
- 8
- Rep Power
- 0
- 03-15-2012, 08:54 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,405
- Blog Entries
- 7
- Rep Power
- 17
Re: you cant do var.length - 1?
x.length-1 is an int expression; you need a boolean expression for the 'for-condition' part; you probable meant:
kind regards,Java Code:for (int i= 1; i < x.length-1; i++) // ...
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 03-15-2012, 08:59 PM #3
Re: you cant do var.length - 1?
You have done mistake in for loop,
at the place of condional statement(i.e. x.lingth - 1).
To overcome this error,
either,you have to give any boolean type value or any conditional statement there,
then only the error can be removed.
as like...
for (int i=1; i< x.length ; i++)
total = total + x[i];
- 03-15-2012, 09:28 PM #4
Member
- Join Date
- Mar 2012
- Posts
- 8
- Rep Power
- 0
Similar Threads
-
Difference between length() and length
By mitra in forum New To JavaReplies: 7Last Post: 07-28-2011, 12:46 AM -
help with length
By ama91 in forum New To JavaReplies: 15Last Post: 02-21-2011, 01:44 AM -
length and excepton
By javagwcc in forum New To JavaReplies: 5Last Post: 06-28-2010, 11:06 PM -
what does num.length method does?
By kris09 in forum New To JavaReplies: 1Last Post: 08-07-2008, 10:19 PM -
Help with method length
By toby in forum New To JavaReplies: 1Last Post: 07-25-2007, 08:29 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks