Content deleted Content added
→Proposal: Note the fact that Java also has goto support (not just labeled break and continue) |
|||
Line 341:
::Java also ''does'' support the goto statement, not just labeled break and continue. [[Special:Contributions/165.199.1.50|165.199.1.50]] ([[User talk:165.199.1.50|talk]]) 17:37, 3 November 2011 (UTC) (School IP)
:::No, Java does not have a goto statement. The JVM supports a goto bytecode, but goto is not supported in Java source code. -- [[User:Schapel|Schapel]] ([[User talk:Schapel|talk]]) 21:04, 3 November 2011 (UTC)
::''A consequence of this is that although loop conditions (if, while and the exit condition in for) in Java and C++ both expect a boolean expression, code such as if(a = 5) will cause a compile error in Java because there is no implicit narrowing conversion from int to boolean. This is handy if the code were a typo for if(a == 5), but the need for an explicit cast can add verbosity when statements such as if (x) are translated from Java to C++.''
|