Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Page 2 of 2 FirstFirst 12
Results 26 to 29 of 29

Thread: cell size excel and java

  1. #26
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: cell size excel and java

    I do not understand your answers.

    1-What statement gives that exception?
    The exception message gives line 97 as the location. What statement is at line 97?
    Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 12, Size: 12
    at java.util.ArrayList.rangeCheck(ArrayList.java:657)
    at java.util.ArrayList.get(ArrayList.java:433)
    at it.cliente.Confrontare.confrontaTargheVeicolo(Confrontare.java:97)
    2-What is the name of the list?
    Your answer was: cliente.getVeicoloId()
    Do you mean that the list returned by that method was used at line 97 with an index containing 12?

    3-What is the name of the index variable with the value that is past the end of the list?
    You said: clienteIndex
    I do NOT see any statement that uses that index with the list from 2
    I would expect to see something like this:
    cliente.getVeicoloId().get(clienteIndex) //<<<< The list with the index
    But I do not see where the index from 3 is used with the list from 2

    --- Update ---

    I missed this from post#9
     97: 				if (cliente.getTarga().get(clienteIndex).equals(veicolo.getTarga().get(veicoloIndex))) {
    I see indexes into 2 lists:
    cliente.getTarga().get(clienteIndex)
    veicolo.getTarga().get(veicoloIndex)

    What are the values in clienteIndex and veicoloIndex when that statement is executed?

    What are the sizes of the lists returned by cliente.getTarga()
    and veicolo.getTarga()?

    The error message says one of the indexes is 12 and the list it is indexing only has 12 elements. Which ones?

    When you find the index with the value 12, then check the code to see how it got that value.
    If you don't understand my answer, don't ignore it, ask a question.

  2. #27
    Member
    Join Date
    Jun 2017
    Posts
    46
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: cell size excel and java

    clienteIndex --> return 999
    veicoloIndex--> 12

  3. #28
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: cell size excel and java

    clienteIndex --> return 999
    veicoloIndex--> 12
    They are both too big if the list only contains 12 elements.
    The problem is the maximum index is 11 for a list with 12 elements.

    How does the index's value go past 11?
    If you don't understand my answer, don't ignore it, ask a question.

  4. #29
    Member
    Join Date
    Jun 2017
    Posts
    46
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: cell size excel and java

    Quote Originally Posted by Norm View Post
    They are both too big if the list only contains 12 elements.
    The problem is the maximum index is 11 for a list with 12 elements.

    How does the index's value go past 11?
    Thanks, I solved.

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Get Cell value in Excel to TextField
    By mdhs in forum What's Wrong With My Code?
    Replies: 1
    Last Post: September 16th, 2014, 08:18 AM
  2. Issue while set formula for Excel cell
    By vinothparthasarathy in forum What's Wrong With My Code?
    Replies: 0
    Last Post: December 15th, 2013, 09:02 AM
  3. getting java code to cell phone
    By crtravel in forum What's Wrong With My Code?
    Replies: 1
    Last Post: September 10th, 2013, 03:43 PM
  4. Excel Text Box to string in a cell
    By ecornes in forum What's Wrong With My Code?
    Replies: 1
    Last Post: January 12th, 2012, 01:34 PM
  5. set Background Excel cell color using POI API
    By ngamal in forum What's Wrong With My Code?
    Replies: 2
    Last Post: March 26th, 2011, 11:20 AM