I do not understand what is the difference between main.Number and kotlin.Number I am create a class in the main function in my program named Number and tried to put like constructor n1 a number that the user input when I try to save this a list the type Number type mismatch is throw . How can I fix this
You’re declaring the list before the number, and so kotlin is assuming that you mean the built-in Number class, instead of your own local Number class. If you move the list declaration to be above the list, then everything should compile successfully.
That’s because Number is declared as a normal class, and so its toString() method is the default one, which just prints its name and an identifier. Instead, declare it as data class Number(...), which automatically adds the toString() function sensibly. I’d also suggest you read some of the introduction docs