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, . | ©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 .