Unless one is a sub-class of the other, you can't cast (and even then, you can only cast up, exceptions being objects viewed as a poly-morphed super object). What you can do is declare your list to hold elements that both objects initially inherited from (this is the basis for polymorphism and OOP code re-use):
public class A
{}
public class B extends A
{}
public class C extends A
{}
public class Main
{
public static void main(String[] args)
{
List<A> list = new ArrayList<A>();
list.add(new B());
list.add(new C());
list.add(new A());
}
}
If you don't want to create your own super class, you can use the Object class since everything inherits from Object.