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

Chapter 4 (part 1) - Defining your own classes. After you have read and studied this chapter, you should be able to: Define a class with multiple methods and data members, differentiate the local and instance variables, define and use value-returning methods, distinguish private and public methods, distinguish private and public data members, pass both primitive data and objects to a method. | ©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 4 - Chapter 4 Defining Your Own Classes Part 1 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 Define a class with multiple methods and data members Differentiate the local and instance variables Define and use value-returning methods Distinguish private and public methods Distinguish private and public data members Pass both primitive data and objects to a method Intro to OOP with Java, C. Thomas Wu ©The McGraw-Hill Companies, Inc. ©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 4 - Why Programmer-Defined Classes Using just the String, GregorianCalendar, JFrame and other standard classes will not meet all of our needs. We need to be able to define our own classes customized for our applications. Learning how to define our own classes is the first step toward mastering the skills necessary in building large programs. Classes we define ourselves are called programmer-defined classes. Intro to OOP with Java, C. Thomas Wu ©The McGraw-Hill Companies, Inc. The sample application programs we have written so far included only one class, the main class of the program. And the main class contained only one method, the main method. When we review the sample programs developed so far, we note two key characteristics: The programs included only one class, the main class of the program. The main class contained only one method, the main method. From this main method, we used objects and classes from the standard packages such as and . Such organization works only for small programs. In order to manage complexity of large programs, it is best to define instantiable classes. ©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 4 - First . | ©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 4 - Chapter 4 Defining Your Own Classes Part 1 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 Define a class with multiple methods and data members Differentiate the local and instance variables Define and use value-returning methods Distinguish private and public methods Distinguish private and public data members Pass both primitive data and objects to a method Intro to OOP with Java, C. Thomas Wu ©The McGraw-Hill Companies, Inc. ©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 4 - Why Programmer-Defined Classes Using just the String, GregorianCalendar, JFrame and other standard classes will not meet all of our needs. We need to be able to define our own classes customized for our applications. Learning how

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã 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.