For example when multiplying Vector to Matrix:
class VecMat { static class Vec { Vec multiply(Mat A) { return this; } } static class Mat {} public static void main(String[] s) { Vec a = new Vec(); Mat A = new Mat(); System.out.println(a*A); } }
a*A
transforms to ((Mat)a).multiply(A)
which causes ClassCastException at runtime.