TAILIEUCHUNG - Lecture An introduction to object-oriented programming with Java: Chapter 6 - C. Thomas Wu

Chapter 6 - Repetition statements. In this chapter we will cover another group of control statements called repetition statements. Repetition statements control a block of code to be executed for a fixed number of times or until a certain condition is met. We will describe Java’s three repetition statements: while, do–while, and for. | ©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 6 - Chapter 6 Repetition Statements Animated Version Introduction to OOP with Java 4th Ed, C. Thomas Wu © The McGraw-Hill Companies, Inc. Objectives After you have read and studied this chapter, you should be able to Implement repetition control in a program using while statements. Implement repetition control in a program using do-while statements. Implement a generic loop-and-a-half repetition control statement Implement repetition control in a program using for statements. Nest a loop repetition statement inside another repetition statement. Choose the appropriate repetition control statement for a given task (Optional) Write simple recursive methods Intro to OOP with Java, C. Thomas Wu ©The McGraw-Hill Companies, Inc. We will study two forms of repetition statements in this lesson. They are while and do-while statement. ©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 6 - Definition Repetition statements control a block of code to be executed for a fixed number of times or until a certain condition is met. Count-controlled repetitions terminate the execution of the block after it is executed for a fixed number of times. Sentinel-controlled repetitions terminate the execution of the block after one of the designated values called a sentinel is encountered. Repetition statements are called loop statements also. Intro to OOP with Java, C. Thomas Wu ©The McGraw-Hill Companies, Inc. In Chapter 5, we studied selection control statements. We will study in this chapter the second type of control statement, a repetition statement, that alters the sequential control flow. It controls the number of times a block of code is executed. In other words, a block of code is executed repeatedly until some condition occurs to stop the repetition. There are fundamentally two ways to stop the repetition—count-controlled and .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.