You are trying to cast an array (Ljavaapplication28.Client) to a Client object (javaapplication28.Client) which definitely causes the error.