Lecture An introduction to computer science using java (2nd Edition): Chapter 12 - S.N. Kamin, D. Mickunas, E. Reingold

Chapter 12 - Inheritance and exceptions. In this chapter we will: show how to organize predefined classes using Java packages, how access to methods and variables is controlled, discuss the use of class inheritance to refine and extend classes, refine our presentation on Java interfaces as a means of specifying object behavior, show how programmer-defined exceptions are created, thrown and caught. | Chapter 12 Inheritance and Exceptions Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by . Kamin, D. Mickunas, E. Reingold Chapter Preview In this chapter we will: show how to organize predefined classes using Java packages how access to methods and variables is controlled discuss the use of class inheritance to refine and extend classes refine our presentation on Java interfaces as a means of specifying object behavior show how programmer-defined exceptions are created, thrown and caught Java Packages Application programmer interface (API) All classes provided to programmers along with the Java compiler (. Math or MouseEvent) Java expects to find these classes in separate directories or folders The classes stored in each directory form a package The package names are formed by concatenating the directory names starting from a particular root directory Some Predefined Java Packages Package Name Contents Classes for implementing applets Classes for graphics, windows, and GUI’s Classes supporting AWT event handling Classes for image handling Interface definitions s for platform independent graphical user interfaces (GUI’s) Classes for input and output Basic language classes like Math (always available in any Java program) Classes for networking Useful auxiliary classes like Date Package Component Names Using a fully qualified component name x = (3); Using an import statement // to allow unqualified references to // all package classes import .*; // to allow unqualified references to // a particular package class import ; Import Examples This code d = new (); p = new (1,2); b = new (); Can be abbreviated import ; Import .*; Date d = new Date(); Point p = new | Chapter 12 Inheritance and Exceptions Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by . Kamin, D. Mickunas, E. Reingold Chapter Preview In this chapter we will: show how to organize predefined classes using Java packages how access to methods and variables is controlled discuss the use of class inheritance to refine and extend classes refine our presentation on Java interfaces as a means of specifying object behavior show how programmer-defined exceptions are created, thrown and caught Java Packages Application programmer interface (API) All classes provided to programmers along with the Java compiler (. Math or MouseEvent) Java expects to find these classes in separate directories or folders The classes stored in each directory form a package The package names are formed by concatenating the directory names starting from a particular root directory Some Predefined Java Packages Package Name Contents Classes for .

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
15    91    2    30-04-2024
Đã 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.