Top "Classcastexception" questions

The Java exception thrown to indicate that the code has attempted to cast an object to a subclass of which it is not an instance.

explicit casting from super class to subclass

public class Animal { public void eat() {} } public class Dog extends Animal { public void eat() {} public void main(String[] args) { Animal …

java casting classcastexception
ClassCastException, casting Integer to Double

ArrayList marks = new ArrayList(); Double sum = 0.0; sum = ((Double)marks.get(i)); Everytime I try to run my program, I get …

java classcastexception
android.app.Application cannot be cast to android.app.Activity

I'm trying to change a LinearLayout from another class, but when i run this code: public class IRC extends PircBot { …

java android android-activity classcastexception
java.lang.String cannot be cast to [Ljava.lang.String;

I have the following and I get the error java.lang.String cannot be cast to [Ljava.lang.String; I …

java jpa classcastexception
ClassCastException when casting to the same class

I have 2 different Java projects, one has 2 classes: dynamicbeans.DynamicBean2 and dynamic.Validator. On the other project, I load both …

java reflection classcastexception websphere-portal
java: (String[])List.toArray() gives ClassCastException

The following code (run in android) always gives me a ClassCastException in the 3rd line: final String[] v1 = i18nCategory.…

java list classcastexception toarray
How to convert ArrayList to String[] in java, Arraylist contains VO objects

Please help me to convert ArrayList to String[]. The ArrayList contains values of type Object(VO). For example, The problem …

java arrays arraylist classcastexception
MyClass cannot be cast to java.lang.Comparable: java.lang.ClassCastException

I am doing a java project and I got this problem and don't know how to fix it. The classes …

java sorting exception classcastexception comparable
Android - FATAL EXCEPTION: main - Unable to start activity ComponentInfo

My problem is that when I run my app on the android emulator the app starts up but quickly crashes …

java android fatal-error classcastexception runtimeexception
[java.lang.String; cannot be cast to java.lang.String

I'm obtaining a Vector from a product's API. Vector<?> dataVector = dataAPI.getReturnVector(); The vector is expected to contain …

java string vector classcastexception