Object Oriented Software Engineering   View all facts   Glossary   Help
subject > programming language construct > statement > decision-making statement > Java decision-making statement > Java if statement
Next Java decision-making statementJava switch statement    UpJava decision-making statement    Previous Java decision-making statementJava try catch statement   

Java if statement
subjectfact 
Java if statementcan omit curly brackets:
if(condition)
doSomething();
else
doSomethingElse();
if it contains only a single statement
2001-08-30 14:56:14.0
has form
if(condition)
{
// statements to execute if condition is true
}
else
{
// statements to execute if condition is false
}
link: chapter2section2.8.html#725, 2001-08-30 14:56:14.0
has part else block2001-08-30 14:56:14.0
is a subtopic of The Basics of Java2001-08-30 14:56:14.0
is a kind of Java decision-making statement2001-08-30 14:56:14.0
Java statementis terminated by a semicolon2001-08-30 14:56:21.0
statementshould be not more than one line long if possible2001-08-30 14:57:47.0