Your class is named ArrayClass1 but your constructor is named ArrayClass. And your print function needs to have a return type, presumably void. There are many logic errors in your program as well. For instance you are accessing the array with size, but that is the size of the array, which is out-of-bounds as an index.