A simple question. Is it possible to have comments in Text Blocks in Java 17?
Since Java 15 Text Blocks are an option:
"""
Hello Hello //how to create a comment here? - this was wanted by customer XXX
This dog has a big nose // This line came with version 1.0.2
This cat needs to eat
"""
Is it possible to have comments inside a text block? I would like to tag some lines that came with new customers etc. Is this possible, will this be possible?
The Java Language Specification states that:
The lexical grammar implies that comments do not occur within character literals, string literals, or text blocks
(emphasis mine)
So nope, you can't do that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With