Call a method named `var` in Scala [duplicate]

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


Call a method named `var` in Scala [duplicate]



This question already has an answer here:



I am using a third-part Java library, which defines a method named var. In Java, that is not a problem. In Scala, varis a reserved word and obj.var() gives a compilation error.


var


var


obj.var()



Is there a more elegant solution to this than obj.getClass().getMethod("var").invoke()?


obj.getClass().getMethod("var").invoke()



This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.





how about `var` with backticks?
– Joel Berkeley
4 mins ago




`var`





Scala literal identifiers (backticks)
– prayagupd
1 min ago




Popular posts from this blog

Arduino Mega cannot recieve any sketches, stk500_recv() programmer is not responding

Visual Studio Code: How to configure includePath for better IntelliSense results

Future solutions