Results 1 to 2 of 2
  1. #1
    proggrammer is offline Member
    Join Date
    Jun 2012
    Posts
    6
    Rep Power
    0

    Unhappy Caught: java.lang.ClassCastException: java.util.ArrayList cannot be cast to Point4D

    I cant Understand the error, what is the meaning of this error? when it can occur? and as my code is very big and due to some reason I am unable to post the code, please help me .. Am developing it on IntelliJ, but its not showing the line number either, suggest me any way to get out of this error and make the code working.

    Any debugging technique may also serve the perpose I think.

    by the way Point4D is my defined class having four integers.

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,401
    Rep Power
    25

    Default Re: Caught: java.lang.ClassCastException: java.util.ArrayList cannot be cast to Point

    The JVM caught the code trying to cast an object that is an ArrayList to be a Point4D and told you about it.
    Why does the code try to do that? It is not possible.

    You will have to post the lines of code where the error occurred and where the variables used on the line where the error occured are defined.


    Add a println that prints the value that is being cast to see what it is if you do not believe the JVM.

    its not showing the line number
    Do the catch blocks call the printStackTrace() method?
    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. Replies: 2
    Last Post: 01-21-2011, 06:22 AM
  2. java.lang.ClassCastException
    By gomsy123 in forum Advanced Java
    Replies: 1
    Last Post: 03-19-2009, 05:39 PM
  3. java.lang.ClassCastException
    By wrwelden in forum New To Java
    Replies: 4
    Last Post: 05-22-2008, 03:43 PM
  4. Replies: 1
    Last Post: 08-02-2007, 04:07 PM
  5. Replies: 1
    Last Post: 07-31-2007, 05:52 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •