What exactly is <code> in Java [closed]
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 years ago.
开发者_StackOverflow社区 Improve this questionEdit: Thanks for the quick answers. Please mark this question for deletion. It doesn't serve SO in any way.
I was reading an article here {Listing 2. Iterating a file
} and what stumped me was the literal <code>
written in Java! - I've never seen that before - I now get it's meaning somewhat but has it been there since beginning or is it a new feature.
I am reproducing part of the code here..
return new Iterable<String>() {
public <code>Iterator</code><String> iterator() {
return new <code>Iterator</code><String>() {
public boolean hasNext() {
return line != null;
.....
It's an error in the HTML markup of the site. Rightclick page and view source. It's been marked up as <code>Iterator</code>
instead of <code>Iterator</code>
.
This has nothing to do with Java. You might contact the site/page author to have them to fix it.
It's probably a remnant of generating code using JavaDoc. The <code></code> tags are used to highlight Java code in JavaDoc, in which it generates a Courier New font.
Haha I think it's just HTML that's mistakenly shown as Java code, it's not part of the language. :)
I think that is a HTML formatting error. They are trying to use their custom code tag within another code tag.
That's not valid java. I think it's a typo.
After all the correct answers an alternative explanation:
It is to protect the code by making it uncompilable. That way no-one can steal it:)
精彩评论