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

Chapter 7 - Defining your own classes (part 2). After studying this chapter you will be able to: Describe how objects are returned from methods, describe how the reserved word this is used, define overloaded methods and constructors, define class methods and variables, describe how the arguments are passed to the parameters using the pass-by-value scheme, document classes with javadoc comments, organize classes into a package. | ©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 7 - Chapter 7 Defining Your Own Classes Part 2 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 Describe how objects are returned from methods Describe how the reserved word this is used Define overloaded methods and constructors Define class methods and variables Describe how the arguments are passed to the parameters using the pass-by-value scheme Document classes with javadoc comments Organize classes into a package Intro to OOP with Java, C. Thomas Wu ©The McGraw-Hill Companies, Inc. A class is instantiable if we can create instances of it. For example, the JFrame class is instantiable. A class is noninstantiable if we cannot create its instances. The Math class is one example of noninstantiable classes. The main classes we have been writing are all noninstantiable. We will learn how to define instantiable classes in this lesson. A constructor is a special method that is used to initialize an instance of a class when it is first created. ©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 7 - Returning an Object from a Method As we can return a primitive data value from a method, we can return an object from a method also. We return an object from a method, we are actually returning a reference (or an address) of an object. This means we are not returning a copy of an object, but only the reference of this object Intro to OOP with Java, C. Thomas Wu ©The McGraw-Hill Companies, Inc. We already know how to return an object from a method, because we have been returning a string from a method and a string is an object (an instance of the String class). However, String objects are treated much like primitive data. We will explore a little deeper into this topic. ©The McGraw-Hill Companies, .

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.