java.lang.ClassCastException

后端 未结 6 653
感情败类
感情败类 2020-11-29 07:27

Normally whats the reason to get java.lang.ClassCastException ..? I get the following error in my application

java.lang.ClassCastException: [Lcom.rsa.authag         


        
6条回答
  •  半阙折子戏
    2020-11-29 08:01

    It's because you're casting to the wrong thing - you're trying to convert to a particular type, and the object that your express refers to is incompatible with that type. For example:

    Object x = "this is a string";
    InputStream y = (InputStream) x; // This will throw ClassCastException
    

    If you could provide a code sample, that would really help...

提交回复
热议问题