How I can cast a variable in Scala?

 
 

Share on Google+Share on Google+

Java Coder
How I can cast a variable in Scala?
1 Answer(s)      12 days ago
Posted in : Big Data

Hi,

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

Thanks

Ads
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


Ads









Ads

 
Advertisement null

Ads