Results 1 to 5 of 5
Thread: Indexing starting with 1
- 01-02-2008, 09:53 AM #1
Senior Member
- Join Date
- Nov 2007
- Posts
- 115
- Rep Power
- 0
Indexing starting with 1
Indexing in Java starts with 0.
I am working in an application where I need it to start with 1. I know this can be done by subtracting 1 simply. For instance, if I want to fetch the 3rd item, it will be:
Is there some pattern for this? I mean whats is the best way of achieving this.Java Code:array[3-1];
- 01-02-2008, 10:05 AM #2
If it's number (like 3 above) your approach is the simple and best approach. In variables (index variables) subtract it by one first before the array operation.
There is no best way though .. i would go over line by line making every thing correct..dont worry newbie, we got you covered.
- 01-02-2008, 11:19 AM #3
Senior Member
- Join Date
- Nov 2007
- Posts
- 115
- Rep Power
- 0
Thanks roots.
nice signature :D
- 01-04-2008, 11:30 AM #4
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Roots is correct. In such a case do all the indexing operation with a temp value before doing the array operations.
- 01-04-2008, 12:03 PM #5
Similar Threads
-
Lucene Re-Indexing
By connect2srinath in forum LuceneReplies: 1Last Post: 05-11-2008, 05:35 PM -
Help, starting with java
By mathias in forum New To JavaReplies: 2Last Post: 08-15-2007, 07:15 AM -
just starting
By specbailey in forum New To JavaReplies: 23Last Post: 08-13-2007, 11:25 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks