Java Static vs Dynamic Casting

Every time I needed to cast objects in Java I always thought dynamic casting, using Class.cast() was more expensive than simply using the (cast) operator. But apparently in Java, static vs dynamic casting don’t mean much difference. Let’s consider this code. And a class that implements my interface. Now I’ll create a situation that requires … Read more