Before you start writing code, you need to know how to multiply two matrices and what are the conditions to do so. Consider these images: Multiplication is applicable, because the number of Columns (Matrix 1) == the number of Rows (Matrix 2). Multiplication is not applicable, because The number of Columns (Matrix 1) != the number of Rows (Matrix 2).
Arrays in Java
Java Packages - Creation And Use