开发者

How do I call a Java method named the same as a Scala keyword? [duplicate]

开发者 https://www.devze.com 2023-03-18 18:12 出处:网络
This question already has an answer here: Closed 11 years ago.开发者_开发技巧 Possible Duplicate:
This question already has an answer here: Closed 11 years ago.开发者_开发技巧

Possible Duplicate:

Using Java Lib with Scala Reserved Words

I'm experimenting with Scala, and a Java library I'm using has a with method on one of its objects, but with is a keyword in Scala. How do I call this method from my Scala code?


From http://ofps.oreilly.com/titles/9780596155957/TypeLessDoMore.html#ReservedWords

Some Java methods use names that are reserved by Scala, e.g., java.util.Scanner.match. To avoid a compilation error, surround the name with single back quotes, e.g., java.util.Scanner.‵match‵.

(edited for formatting)

0

精彩评论

暂无评论...
验证码 换一张
取 消