) ) ) )
{
if (sentence.length() >=20);
throw new MessageTooLongException();
}
) ) ) )
) ) ) )
) ) ) )
) ) ) )
) ) ) )
To give a typical example
int i=0;
if (i==1){
System.out.println("Good morning");
}
The curly braces create a block of code, which means if the test is true it will execute multiple lines of code. You can use the if statement without the braces so it is only the next line that is executed conditionally, using this format the previous example would appear as
int i=0;
if (i==1)
System.out.println(" Good morning");
However, many people consider this to be bad style as it is too easy to get confused as to where the impact of the if statement starts and stops.
) ) ) )
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|