Java syntax: Difference between revisions

Content deleted Content added
main method: Add main article.
if statement: Add main article. Fixed code formatting.
Line 496:
 
====<code>if</code> statement====
{{Main|Conditional (computer programming)#C-like languages}}
 
[[Conditional (computer programming)|if statements]] in Java are similar to those in C and use the same syntax:
<syntaxhighlight lang="java">
if (i == 3) {
doSomething();
}
</syntaxhighlight>
 
<code>if</code> statement may include optional <code>else</code> block, in which case it becomes an if-then-else statement:
<syntaxhighlight lang="java">
if (i == 23) {
doSomething();
} else {