Lecture Introduction to Java programming - Chapter 8: Objects and classes

Having learned the material in earlier chapters, you are able to solve many programming problems using selections, loops, methods, and arrays. However, these Java features are not sufficient for developing graphical user interfaces and large-scale software systems. This chapter begins the introduction of object-oriented programming, which will enable you to develop GUI and large-scale software systems effectively. | Chapter 8 Objects and Classes Motivations After learning the preceding chapters, you are capable of solving many programming problems using selections, loops, methods, and arrays. However, these Java features are not sufficient for developing graphical user interfaces and large scale software systems. Suppose you want to develop a graphical user interface as shown below. How do you program it? Objectives To describe objects and classes, and use classes to model objects (§). To use UML graphical notations to describe classes and objects (§). To demonstrate defining classes and creating objects (§). To create objects using constructors (§). To access objects via object reference variables (§). To define a reference variable using a reference type (§). To access an object’s data and methods using the object member access operator (.) (§). To define data fields of reference types and assign default values for an object’s data fields (§). To distinguish between object reference variables and primitive data type variables (§). To use classes Date, Random, and JFrame in the Java library (§). To distinguish between instance and static variables and methods (§). To define private data fields with appropriate get and set methods (§). To encapsulate data fields to make classes easy to maintain (§). To develop methods with object arguments and differentiate between primitive-type arguments and object-type arguments (§). To store and process objects in arrays (§). OO Programming Concepts Object-oriented programming (OOP) involves programming using objects. An object represents an entity in the real world that can be distinctly identified. For example, a student, a desk, a circle, a button, and even a loan can all be viewed as objects. An object has a unique identity, state, and behaviors. The state of an object consists of a set of data fields (also known as properties) with their current values. The behavior of | Chapter 8 Objects and Classes Motivations After learning the preceding chapters, you are capable of solving many programming problems using selections, loops, methods, and arrays. However, these Java features are not sufficient for developing graphical user interfaces and large scale software systems. Suppose you want to develop a graphical user interface as shown below. How do you program it? Objectives To describe objects and classes, and use classes to model objects (§). To use UML graphical notations to describe classes and objects (§). To demonstrate defining classes and creating objects (§). To create objects using constructors (§). To access objects via object reference variables (§). To define a reference variable using a reference type (§). To access an object’s data and methods using the object member access operator (.) (§). To define data fields of reference types and assign default values for an object’s data fields (§). To .

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.