Closed youseftcg closed 3 years ago
It turned out that it's not a mistake, but rather, Random()
in the codelab refers to the Radom class in Java, which has a normal consturctor, hence using Random() is ok if the Random Java class is imported, however, if the user is using the Random Kotlin Class, an error will be thrown "Cannot create an instance of an abstract class"
Describe the problem An instance of a class is used while it's an abstract class,
Random().nextInt()
is used, whileRandom.nextInt()
is the one that should be used.In which step of the codelab can this issue be found? Step 3 in the second snippet of code:
codelab: kotlin-bootcamp