Đang chuẩn bị liên kết để tải về tài liệu:
Java Programming for absolute beginner- P6

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Java Programming for absolute beginner- P6:Hello and welcome to Java Programming for the Absolute Beginner. You probably already have a good understanding of how to use your computer. These days it’s hard to find someone who doesn’t, given the importance of computers in today’s world. Learning to control your computer intimately is what will separate you from the pack! By reading this book, you learn how to accomplish just that through the magic of programming. | JavaProgAbsBeg-03.qxd 2 25 03 8 49 AM Page 78 78 Java Programming for the Absolute Beginner FIGURE 3.10 This is several runs of the HighOrLowTemp program. Nesting if-else Structures So far you are able to conditionally execute one of two statements based on a single condition. Sometimes you need to have more than two branches in the flow of your program based on a set of related conditions. This is possible in Java. You know that in the if-else structure the statement any valid Java statement that the program executes if the condition is false follows the else keyword. The key here is any valid Java statement-including another conditional statement. These types of structures are called nested if-else statements. Take a look at the syntax if conditionl java_statements_for_true_condition1 else if condition java_statements_for_true_condition2 else java_statements_for_false_conditions If conditionl is true the program executes java_statements_for_true_condi-tionl. If conditionl is false conditiond is tested. You do this by immediately following the else keyword with another if conditional statement. If condition2 is true the program executes java_statements_for_true_condition2. Finally if neither condition is true the java_statements_for_false_conditions are executed. Take a look at this quick example and then move on to the next section where you use apply this concept in an actual program if name Joseph System.out.println name is my first name. else if name Russell System.out.println name is my last name. else System.out.println name is not my name. team Line - live informative Non-cost and Genuine Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. JavaProgAbsBeg-03.qxd 2 25 03 8 49 AM Page 79 79 Assume that name is a string holding some person s name. This snippet of code indicates that the name is my first name if it is Joseph else if it is Russell the code indicates that it is my last name. If it is neither my first name nor my last name

Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.