您的位置:寻梦网首页编程乐园Java天地Core JavaJava Lecture Notes

Introduction

Content

Apply

Reflect

Extend

previous.gif
 (3087 bytes) next.gif
 (2959 bytes)


Content Index

Content Page # 25

:Selection: `if' with compound statement

The statement that is to be executed if the test is true can either be a single statement such as soundAlarm() above, or it can be a compound statement (one or more statements blocked with the open and close braces "{" "}"). For example, we might wish to perform more than one action if the temperature is too high:

 

if (temperature > 78)

{

  soundAlarm();

  displayFlashingLight( red );

  triggerAlarmAtFireStation();

}

Back to top

basicline.gif (169 bytes)

RITSEC - Global Campus
Copyright ?1999 RITSEC- Middlesex University. All rights reserved.
webmaster@globalcampus.com.eg