Click here to Skip to main content
15,903,175 members
Home / Discussions / Java
   

Java

 
PinnedForum Guidelines - PLEASE READ Pin
Chris Maunder28-Jul-09 2:36
cofounderChris Maunder28-Jul-09 2:36 
QuestionMy java output is running but the output does not follow assignment format Pin
Olivia824-Mar-24 20:18
Olivia824-Mar-24 20:18 
AnswerRe: My java output is running but the output does not follow assignment format Pin
OriginalGriff24-Mar-24 20:24
mveOriginalGriff24-Mar-24 20:24 
QuestionJava assignmnent due tonigh!! error message "Index 1 out of bounds for length 1" Pin
Olivia824-Mar-24 6:23
Olivia824-Mar-24 6:23 
AnswerRe: Java assignmnent due tonigh!! error message "Index 1 out of bounds for length 1" Pin
OriginalGriff24-Mar-24 6:28
mveOriginalGriff24-Mar-24 6:28 
Simple: Java indexes run from 0 to N-1, where N is the number of elements in the collection.

So if you have an array with three elements, the only valid indexes are 0, 1, and 2 - any index that is 3 or higher or that is negative is invalid and you will get this error message.

In your specific case, the error is telling you that you are using an index of 1 to access a collection with a single element - so the only valid index will be zero. Read this: How to Write Code to Solve a Problem, A Beginner's Guide Part 2: Syntax Errors[^] to find out where the error occurs and than use the debugger to find out why the collection contains fewer elements than you thought, or why the index is bigger than it should be. (It's primarily about syntax errors, but the message format is generally similar for run time errors as well)

[edit]
But one thing I did notice while adding code blocks to your original post is that that isn't CSV data: CSV stands for "Comma Separated Values" and your data as shown contains no commas ... this may be relevant to your problem ... check the data you read with the debugger and you'll see what I mean.
[edit]
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!


modified 24-Mar-24 12:38pm.

GeneralRe: Java assignmnent due tonigh!! error message "Index 1 out of bounds for length 1" Pin
Olivia824-Mar-24 10:11
Olivia824-Mar-24 10:11 
GeneralRe: Java assignmnent due tonigh!! error message "Index 1 out of bounds for length 1" Pin
OriginalGriff24-Mar-24 20:19
mveOriginalGriff24-Mar-24 20:19 
GeneralRe: Java assignmnent due tonigh!! error message "Index 1 out of bounds for length 1" Pin
jschell26-Mar-24 12:03
jschell26-Mar-24 12:03 
AnswerRe: Java assignmnent due tonigh!! error message "Index 1 out of bounds for length 1" Pin
jimakoskx24-Mar-24 22:30
jimakoskx24-Mar-24 22:30 
GeneralSecurity Manager gone Pin
jschell20-Mar-24 12:52
jschell20-Mar-24 12:52 
Questionlarge numbers Pin
mike741114-Jan-24 12:58
mike741114-Jan-24 12:58 
AnswerRe: large numbers Pin
Pete O'Hanlon14-Jan-24 20:47
mvePete O'Hanlon14-Jan-24 20:47 
AnswerRe: large numbers Pin
Richard MacCutchan14-Jan-24 21:42
mveRichard MacCutchan14-Jan-24 21:42 
QuestionPlease help me with this password validation - While Loop Running Once Pin
R1s1ng Phoen1x14-Jan-24 4:35
R1s1ng Phoen1x14-Jan-24 4:35 
AnswerRe: Please help me with this password validation - While Loop Running Once Pin
Richard MacCutchan14-Jan-24 5:15
mveRichard MacCutchan14-Jan-24 5:15 
GeneralRe: Please help me with this password validation - While Loop Running Once Pin
R1s1ng Phoen1x14-Jan-24 5:58
R1s1ng Phoen1x14-Jan-24 5:58 
GeneralRe: Please help me with this password validation - While Loop Running Once Pin
Richard MacCutchan14-Jan-24 6:06
mveRichard MacCutchan14-Jan-24 6:06 
AnswerRe: Please help me with this password validation - While Loop Running Once Pin
Gerry Schmitz14-Jan-24 5:19
mveGerry Schmitz14-Jan-24 5:19 
GeneralRe: Please help me with this password validation - While Loop Running Once Pin
R1s1ng Phoen1x14-Jan-24 5:59
R1s1ng Phoen1x14-Jan-24 5:59 
Questionviewing Java disassembly Pin
mike741111-Jan-24 22:55
mike741111-Jan-24 22:55 
AnswerRe: viewing Java disassembly Pin
Richard MacCutchan11-Jan-24 23:22
mveRichard MacCutchan11-Jan-24 23:22 
GeneralRe: viewing Java disassembly Pin
jschell12-Jan-24 10:13
jschell12-Jan-24 10:13 
GeneralRe: viewing Java disassembly Pin
Richard MacCutchan12-Jan-24 22:09
mveRichard MacCutchan12-Jan-24 22:09 
AnswerRe: viewing Java disassembly Pin
jschell12-Jan-24 10:14
jschell12-Jan-24 10:14 
GeneralRe: viewing Java disassembly Pin
mike741112-Jan-24 10:25
mike741112-Jan-24 10:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.