The program outputs zero because the numSame method is calling the 3 arrays you declared at the start. In other words, they're empty, so your if-statement is evaluating whether 0 equals the array...