0

When do we have to use typecasting and anonymous classes in real time project?

22nd Jun 2017, 9:11 AM
Sangay Wangmo
Sangay Wangmo - avatar
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
14th Jul 2017, 2:23 PM
ein siedler
ein siedler - avatar