0
When do we have to use typecasting and anonymous classes in real time project?
1 Answer
0
Most Common example of type casting in Java is getting a random number. Since the method Math.random() Returns a values of the type long but normally we work with an int we have to casting it like this:
int x=(int) Math.random();
And getting random numbers is very Common