开发者

Equivalent verbatim operator for java [duplicate]

This question already has answers here: Raw Strings in Java - for regex in particular. Multiline strings (13 answers) Closed 9 years 开发者_高级运维ago.

Does java have an equivalent operator or language construct as the verbatim operator(@) in C#?


No, Java does not have such an operator.


Quick Googling tells me that verbatim operator in C# is apparently just syntactic sugar.

No, there's no equivalent in Java. Java isn't about syntactic sugar, the main focus of Java as a language is to provide only one way to perform or otherwise get a single function, that's why each reserved word in Java has only one function and a lot of syntactic sugar is missing. Just to emphasise, @ is already reserved for annotations.

While the benefits and shortcomings of this can be discussed to eternity, the bottom line is that Java is really sparse in syntactic sugar, in fact only syntactic sugar in Java I can think of is the enhanced for loop and even then internally JVM knows only of while loops, anyway.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜