How I can cast a variable in Scala?

Hi,

Trying Big Data and now I want to learn to cast variables.

Thanks

View Answers

November 12, 2017 at 7:21 PM

Hi,

Suppose you have an object of Graphics and you wan to cast it to Graphics2D then you can use following code:

g.asInstanceOf[Graphics2D];

Similarly you can apply this logic to all other classes in SCALA.

Thanks









Related Tutorials/Questions & Answers:
Advertisements