Java Programming: From Problem Analysis to Program Design, 5e Chapter 8 User-Defined Classes and ADTs
Chapter Objectives <ul><li>Learn about classes </li></ul><ul><li>Learn about  private ,  protected ,  public , and  static...
Chapter Objectives (continued) <ul><li>Examine constructors and finalizers </li></ul><ul><li>Examine the method  toString ...
Classes <ul><li>final class  String  </li></ul><ul><li>{ </li></ul><ul><li>//variables to store a string </li></ul><ul><li...
Classes (continued) <ul><li>class : reserved word; collection of a fixed number of components   </li></ul><ul><li>Componen...
Classes (continued) <ul><li>private : members of class are not accessible outside class </li></ul><ul><li>public : members...
Syntax Java Programming: From Problem Analysis to Program Design, 5e The general syntax for defining a class is:
Syntax (continued) Java Programming: From Problem Analysis to Program Design, 5e <ul><li>If a member of a class is a named...
Syntax (continued) Java Programming: From Problem Analysis to Program Design, 5e <ul><ul><li>If a member of a class is a m...
class  Clock Java Programming: From Problem Analysis to Program Design, 5e <ul><li>Data Members (Instance Variables) </li>...
class  Clock   (continued) <ul><li>Methods   </li></ul><ul><ul><li>public void  setTime( int  hours,  </li></ul></ul><ul><...
Constructors Java Programming: From Problem Analysis to Program Design, 5e <ul><li>Two types of constructors </li></ul><ul...
Constructors (continued) <ul><li>Constructors have the following properties: </li></ul><ul><ul><li>- The name of a constru...
class  Clock : Constructors Java Programming: From Problem Analysis to Program Design, 5e <ul><ul><li>Default constructor ...
Java Programming: From Problem Analysis to Program Design, 5e Unified Modeling Language Class Diagrams
Variable Declaration and Object Instantiation  <ul><li>The general syntax for using the operator  new  is: </li></ul><ul><...
Variable Declaration and Object Instantiation (continued) Java Programming: From Problem Analysis to Program Design, 5e
Variable Declaration and Object Instantiation (continued) Java Programming: From Problem Analysis to Program Design, 5e
Accessing Class Members <ul><li>The syntax to access a data member of a class object or method is: </li></ul><ul><li>Examp...
<ul><li>Assignment Operator: A Precaution </li></ul>Java Programming: From Problem Analysis to Program Design, 5e <ul><li>...
<ul><li>Assignment Operator: A Precaution (continued) </li></ul>Java Programming: From Problem Analysis to Program Design,...
Java Programming: From Problem Analysis to Program Design, 5e Assignment Operator: A Precaution (continued)
Java Programming: From Problem Analysis to Program Design, 5e Definitions of the Constructors and Methods of the  class  C...
Java Programming: From Problem Analysis to Program Design, 5e Definitions of the Constructors and Methods of the  class  C...
Java Programming: From Problem Analysis to Program Design, 5e Definitions of the Constructors and Methods of the  class  C...
Java Programming: From Problem Analysis to Program Design, 5e Definitions of the Constructors and Methods of the  class  C...
Java Programming: From Problem Analysis to Program Design, 5e Definitions of the Constructors and Methods of the  class  C...
Java Programming: From Problem Analysis to Program Design, 5e Definitions of the Constructors and Methods of the  class  C...
Java Programming: From Problem Analysis to Program Design, 5e Definitions of the Constructors and Methods of the  class  C...
Java Programming: From Problem Analysis to Program Design, 5e Definitions of the Constructors and Methods of the  class  C...
Java Programming: From Problem Analysis to Program Design, 5e Definitions of the Constructors and Methods of the  class  C...
Java Programming: From Problem Analysis to Program Design, 5e Definitions of the Constructors and Methods of the  class  C...
Java Programming: From Problem Analysis to Program Design, 5e Definitions of the Constructors and Methods of the  class  C...
Java Programming: From Problem Analysis to Program Design, 5e Definitions of the Constructors and Methods of the  class  C...
Java Programming: From Problem Analysis to Program Design, 5e Default Constructor or
Java Programming: From Problem Analysis to Program Design, 5e Constructor with Parameters or
Java Programming: From Problem Analysis to Program Design, 5e
Java Programming: From Problem Analysis to Program Design, 5e
Java Programming: From Problem Analysis to Program Design, 5e
Java Programming: From Problem Analysis to Program Design, 5e
<ul><li>public  value-returning method </li></ul><ul><li>Takes no parameters </li></ul><ul><li>Returns address of a  Strin...
Method  toString :  class  Clock Java Programming: From Problem Analysis to Program Design, 5e
The Copy Constructor <ul><li>Executes when an object is instantiated </li></ul><ul><li>Initialized using an existing objec...
The Copy Constructor (continued) Java Programming: From Problem Analysis to Program Design, 5e
The Modifier  static <ul><li>In the method heading, it specifies that the method can be invoked by using the name of the c...
Static Members of a Class Java Programming: From Problem Analysis to Program Design, 5e <ul><li>Example 8-5 </li></ul><ul>...
Static Members of a Class (continued) Java Programming: From Problem Analysis to Program Design, 5e void  setX( int  a) { ...
Static Members of a Class (continued) Java Programming: From Problem Analysis to Program Design, 5e Illustrate illusObject...
Static Members of a Class (continued) Java Programming: From Problem Analysis to Program Design, 5e Illustrate.incrementY(...
Finalizers <ul><li>Automatically execute when class object goes out of scope </li></ul><ul><li>Have no parameters </li></u...
Accessor and Mutator Methods <ul><li>Accessor Method : a method of a class that only accesses (that is, does not modify) t...
Java Programming: From Problem Analysis to Program Design, 5e <ul><li>Before moving to the design phase, a problem must be...
Java Programming: From Problem Analysis to Program Design, 5e
Java Programming: From Problem Analysis to Program Design, 5e
Java Programming: From Problem Analysis to Program Design, 5e <ul><li>You can write the Java code of the  class  Clock usi...
The Reference  this <ul><li>Refers to instance variables and methods of a class </li></ul><ul><li>Used to implement cascad...
Inner Classes <ul><li>Defined within other classes </li></ul><ul><li>Can be either a complete class definition or anonymou...
Abstract Data Types <ul><li>Definition </li></ul><ul><ul><li>- A data type that specifies the logical properties without t...
Programming Example: Candy Machine (Problem Statement) Java Programming: From Problem Analysis to Program Design, 5e <ul><...
Programming Example: Candy Machine (Problem Statement) (continued) <ul><li>The non-GUI application program should do the f...
Programming Example: Candy Machine (Input and Output) <ul><li>Input: the item selection and the cost of the    item  </li>...
Programming Example:  Candy Machine <ul><li>Components </li></ul><ul><ul><li>Cash register </li></ul></ul><ul><ul><li>Disp...
Programming Example:  Candy Machine (continued) Java Programming: From Problem Analysis to Program Design, 5e
Programming Example:  Candy Machine (continued) Java Programming: From Problem Analysis to Program Design, 5e
Programming Example:  Candy Machine (continued) Java Programming: From Problem Analysis to Program Design, 5e
Programming Example:  Candy Machine (continued) Java Programming: From Problem Analysis to Program Design, 5e
Programming Example:  Candy Machine (continued) Java Programming: From Problem Analysis to Program Design, 5e
Programming Example:  Candy Machine (continued) Java Programming: From Problem Analysis to Program Design, 5e
Chapter Summary <ul><li>Creating classes </li></ul><ul><li>Members of a class </li></ul><ul><ul><li>private </li></ul></ul...
Chapter Summary (continued) <ul><li>Constructors </li></ul><ul><li>Finalizers </li></ul><ul><li>Method  toString </li></ul...
Upcoming SlideShare
Loading in...5
×

9781111530532 ppt ch08

782
-1

Published on

Published in: Technology, News & Politics
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
782
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
50
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

9781111530532 ppt ch08

  1. 1. Java Programming: From Problem Analysis to Program Design, 5e Chapter 8 User-Defined Classes and ADTs
  2. 2. Chapter Objectives <ul><li>Learn about classes </li></ul><ul><li>Learn about private , protected , public , and static members of a class </li></ul><ul><li>Explore how classes are implemented </li></ul><ul><li>Learn about the various operations on classes </li></ul>Java Programming: From Problem Analysis to Program Design, 5e
  3. 3. Chapter Objectives (continued) <ul><li>Examine constructors and finalizers </li></ul><ul><li>Examine the method toString </li></ul><ul><li>Learn about the abstract data type (ADT) </li></ul>Java Programming: From Problem Analysis to Program Design, 5e
  4. 4. Classes <ul><li>final class String </li></ul><ul><li>{ </li></ul><ul><li>//variables to store a string </li></ul><ul><li>... </li></ul><ul><li>public int compareTo(String anotherString) </li></ul><ul><li>{ </li></ul><ul><li>//code to compare two strings </li></ul><ul><li>} </li></ul><ul><li>public String concat(String str) </li></ul><ul><li>{ </li></ul><ul><li>//code to join two strings </li></ul><ul><li>} </li></ul><ul><li>public String toLowerCase() </li></ul><ul><li>{ </li></ul><ul><li>//code to convert all the characters of a </li></ul><ul><li>//string to lowercase </li></ul><ul><li>} </li></ul><ul><li>... </li></ul><ul><li>} </li></ul>Java Programming: From Problem Analysis to Program Design, 5e
  5. 5. Classes (continued) <ul><li>class : reserved word; collection of a fixed number of components </li></ul><ul><li>Components: members of a class </li></ul><ul><li>Members accessed by name </li></ul><ul><li>Class categories/modifiers </li></ul><ul><ul><li>private </li></ul></ul><ul><ul><li>protected </li></ul></ul><ul><ul><li>public </li></ul></ul>Java Programming: From Problem Analysis to Program Design, 5e
  6. 6. Classes (continued) <ul><li>private : members of class are not accessible outside class </li></ul><ul><li>public : members of class are accessible outside class </li></ul><ul><li>Class members: can be methods or variables </li></ul><ul><li>Variable members declared like any other variables </li></ul>Java Programming: From Problem Analysis to Program Design, 5e
  7. 7. Syntax Java Programming: From Problem Analysis to Program Design, 5e The general syntax for defining a class is:
  8. 8. Syntax (continued) Java Programming: From Problem Analysis to Program Design, 5e <ul><li>If a member of a class is a named constant, you declare it just like any other named constant </li></ul><ul><li>If a member of a class is a variable, you declare it just like any other variable </li></ul><ul><li>If a member of a class is a method, you define it just like any other method </li></ul>
  9. 9. Syntax (continued) Java Programming: From Problem Analysis to Program Design, 5e <ul><ul><li>If a member of a class is a method, it can (directly) access any member of the class—data members and methods </li></ul></ul><ul><ul><ul><li>- Therefore, when you write the definition of a method (of the class), you can directly access any data member of the class (without passing it as a parameter) </li></ul></ul></ul>
  10. 10. class Clock Java Programming: From Problem Analysis to Program Design, 5e <ul><li>Data Members (Instance Variables) </li></ul><ul><ul><li>private int hr; //store hours </li></ul></ul><ul><ul><li>private int min; //store minutes </li></ul></ul><ul><ul><li>private int sec; //store seconds </li></ul></ul>
  11. 11. class Clock (continued) <ul><li>Methods </li></ul><ul><ul><li>public void setTime( int hours, </li></ul></ul><ul><ul><li>int minutes, int seconds) </li></ul></ul><ul><ul><li>public int getHours() </li></ul></ul><ul><ul><li>public int getMinutes() </li></ul></ul><ul><ul><li>public int getSeconds() </li></ul></ul><ul><ul><li>public void printTime() </li></ul></ul><ul><ul><li>public void incrementSeconds() </li></ul></ul><ul><ul><li>public void incrementMinutes() </li></ul></ul><ul><ul><li>public void incrementHours() </li></ul></ul><ul><ul><li>public boolean equals(Clock otherClock) </li></ul></ul><ul><ul><li>public void makeCopy(Clock otherClock) </li></ul></ul><ul><ul><li>public Clock getCopy() </li></ul></ul>Java Programming: From Problem Analysis to Program Design, 5e
  12. 12. Constructors Java Programming: From Problem Analysis to Program Design, 5e <ul><li>Two types of constructors </li></ul><ul><ul><ul><li>- With parameters </li></ul></ul></ul><ul><ul><ul><li>- Without parameters ( default constructor) </li></ul></ul></ul>
  13. 13. Constructors (continued) <ul><li>Constructors have the following properties: </li></ul><ul><ul><li>- The name of a constructor is the same as the name of the class </li></ul></ul><ul><ul><li>- A constructor, even though it is a method, has no type </li></ul></ul><ul><ul><li>- A class can have more than one constructor; all constructors of a class have the same name </li></ul></ul><ul><ul><li>- If a class has more than one constructor, any two constructors must have different signatures </li></ul></ul><ul><ul><li>- Constructors are automatically executed when a class object is instantiated </li></ul></ul><ul><ul><li>- If there are multiple constructors, which constructor executes depends on the type of values passed to the class object when the class object is instantiated </li></ul></ul>Java Programming: From Problem Analysis to Program Design, 5e
  14. 14. class Clock : Constructors Java Programming: From Problem Analysis to Program Design, 5e <ul><ul><li>Default constructor is: </li></ul></ul><ul><ul><ul><li>- public Clock() </li></ul></ul></ul><ul><ul><li>Constructor with parameters is: </li></ul></ul><ul><ul><ul><li>- public Clock( int hours , int minutes , int seconds) </li></ul></ul></ul>
  15. 15. Java Programming: From Problem Analysis to Program Design, 5e Unified Modeling Language Class Diagrams
  16. 16. Variable Declaration and Object Instantiation <ul><li>The general syntax for using the operator new is: </li></ul><ul><li>or: </li></ul><ul><li>Clock myClock; </li></ul><ul><li>Clock yourClock; </li></ul><ul><li>myClock = new Clock(); </li></ul><ul><li>yourClock = new Clock(9, 35, 15); </li></ul>Java Programming: From Problem Analysis to Program Design, 5e
  17. 17. Variable Declaration and Object Instantiation (continued) Java Programming: From Problem Analysis to Program Design, 5e
  18. 18. Variable Declaration and Object Instantiation (continued) Java Programming: From Problem Analysis to Program Design, 5e
  19. 19. Accessing Class Members <ul><li>The syntax to access a data member of a class object or method is: </li></ul><ul><li>Example 8-1 </li></ul><ul><ul><li>myClock.setTime(5, 2, 30); </li></ul></ul><ul><ul><li>myClock.printTime(); </li></ul></ul><ul><ul><li>yourClock.setTime(x, y, z); </li></ul></ul><ul><ul><li>if (myClock.equals(yourClock)) </li></ul></ul><ul><ul><li>. </li></ul></ul><ul><ul><li>. </li></ul></ul><ul><ul><li>. </li></ul></ul>Java Programming: From Problem Analysis to Program Design, 5e
  20. 20. <ul><li>Assignment Operator: A Precaution </li></ul>Java Programming: From Problem Analysis to Program Design, 5e <ul><li>myClock = yourClock; </li></ul><ul><li>Copies the value of the reference variable yourClock into the reference variable myClock </li></ul><ul><ul><li>- After this statement executes, both yourClock and myClock refer to the same object </li></ul></ul>
  21. 21. <ul><li>Assignment Operator: A Precaution (continued) </li></ul>Java Programming: From Problem Analysis to Program Design, 5e <ul><li>Shallow copying: two or more reference variables of the same type point to the same object </li></ul><ul><li>Deep copying: each reference variable refers to its own object </li></ul>
  22. 22. Java Programming: From Problem Analysis to Program Design, 5e Assignment Operator: A Precaution (continued)
  23. 23. Java Programming: From Problem Analysis to Program Design, 5e Definitions of the Constructors and Methods of the class Clock
  24. 24. Java Programming: From Problem Analysis to Program Design, 5e Definitions of the Constructors and Methods of the class Clock (continued)
  25. 25. Java Programming: From Problem Analysis to Program Design, 5e Definitions of the Constructors and Methods of the class Clock (continued)
  26. 26. Java Programming: From Problem Analysis to Program Design, 5e Definitions of the Constructors and Methods of the class Clock (continued)
  27. 27. Java Programming: From Problem Analysis to Program Design, 5e Definitions of the Constructors and Methods of the class Clock (continued)
  28. 28. Java Programming: From Problem Analysis to Program Design, 5e Definitions of the Constructors and Methods of the class Clock (continued)
  29. 29. Java Programming: From Problem Analysis to Program Design, 5e Definitions of the Constructors and Methods of the class Clock (continued)
  30. 30. Java Programming: From Problem Analysis to Program Design, 5e Definitions of the Constructors and Methods of the class Clock (continued)
  31. 31. Java Programming: From Problem Analysis to Program Design, 5e Definitions of the Constructors and Methods of the class Clock (continued)
  32. 32. Java Programming: From Problem Analysis to Program Design, 5e Definitions of the Constructors and Methods of the class Clock (continued)
  33. 33. Java Programming: From Problem Analysis to Program Design, 5e Definitions of the Constructors and Methods of the class Clock (continued)
  34. 34. Java Programming: From Problem Analysis to Program Design, 5e Definitions of the Constructors and Methods of the class Clock (continued)
  35. 35. Java Programming: From Problem Analysis to Program Design, 5e Default Constructor or
  36. 36. Java Programming: From Problem Analysis to Program Design, 5e Constructor with Parameters or
  37. 37. Java Programming: From Problem Analysis to Program Design, 5e
  38. 38. Java Programming: From Problem Analysis to Program Design, 5e
  39. 39. Java Programming: From Problem Analysis to Program Design, 5e
  40. 40. Java Programming: From Problem Analysis to Program Design, 5e
  41. 41. <ul><li>public value-returning method </li></ul><ul><li>Takes no parameters </li></ul><ul><li>Returns address of a String object </li></ul><ul><li>Output using print , println , printf methods </li></ul><ul><li>Default definition creates String with name of object’s class name followed by hash code of object </li></ul>The Method toString Java Programming: From Problem Analysis to Program Design, 5e
  42. 42. Method toString : class Clock Java Programming: From Problem Analysis to Program Design, 5e
  43. 43. The Copy Constructor <ul><li>Executes when an object is instantiated </li></ul><ul><li>Initialized using an existing object </li></ul><ul><li>Syntax </li></ul>Java Programming: From Problem Analysis to Program Design, 5e
  44. 44. The Copy Constructor (continued) Java Programming: From Problem Analysis to Program Design, 5e
  45. 45. The Modifier static <ul><li>In the method heading, it specifies that the method can be invoked by using the name of the class </li></ul><ul><li>If used to declare data member, data member invoked by using the class name </li></ul><ul><li>Static data members of class exist even when no object of class type is instantiated </li></ul><ul><li>Static variables are initialized to their default values </li></ul>Java Programming: From Problem Analysis to Program Design, 5e
  46. 46. Static Members of a Class Java Programming: From Problem Analysis to Program Design, 5e <ul><li>Example 8-5 </li></ul><ul><li>public class Illustrate </li></ul><ul><li>{ </li></ul><ul><li>private int x; </li></ul><ul><li>private static int y; </li></ul><ul><li>public static int count; </li></ul><ul><li>public Illustrate() </li></ul><ul><li>{ </li></ul><ul><li>x = 0; </li></ul><ul><li>} </li></ul><ul><li>public Illustrate( int a) </li></ul><ul><li>{ </li></ul><ul><li>x = a; </li></ul><ul><li>} </li></ul>
  47. 47. Static Members of a Class (continued) Java Programming: From Problem Analysis to Program Design, 5e void setX( int a) { x = a; } public String toString() { return (&quot;x = &quot; + x + &quot;, y = &quot; + y + &quot;, count = &quot; + count); } public static void incrementY() { y++; } } Illustrate illusObject = new Illustrate(); Illustrate.incrementY(); Illustrate.count++;
  48. 48. Static Members of a Class (continued) Java Programming: From Problem Analysis to Program Design, 5e Illustrate illusObject1 = new Illustrate(3); Illustrate illusObject2 = new Illustrate(5);
  49. 49. Static Members of a Class (continued) Java Programming: From Problem Analysis to Program Design, 5e Illustrate.incrementY(); Illustrate.count++;
  50. 50. Finalizers <ul><li>Automatically execute when class object goes out of scope </li></ul><ul><li>Have no parameters </li></ul><ul><li>Only one finalizer per class </li></ul><ul><li>Name of finalizer: finalize </li></ul>Java Programming: From Problem Analysis to Program Design, 5e
  51. 51. Accessor and Mutator Methods <ul><li>Accessor Method : a method of a class that only accesses (that is, does not modify) the value(s) of the data member(s) </li></ul><ul><li>Mutator Method : a method of a class that modifies the value of one or more data member(s) </li></ul>Java Programming: From Problem Analysis to Program Design, 5e
  52. 52. Java Programming: From Problem Analysis to Program Design, 5e <ul><li>Before moving to the design phase, a problem must be thoroughly understood so that the focus is on solving the problem. </li></ul><ul><li>Once a class is designed, it must be properly documented. </li></ul><ul><li>In order to design the class Clock, first we identified the operations and determined that each operation must be implemented using a method. </li></ul><ul><li>We then identified the data members and their types. </li></ul><ul><li>We also identified which member should be public and which should be private . </li></ul><ul><li>An algorithm must be designed and documented to implement a method. </li></ul><ul><li>Describing the algorithm is not as important as the clarity of the algorithm. </li></ul>
  53. 53. Java Programming: From Problem Analysis to Program Design, 5e
  54. 54. Java Programming: From Problem Analysis to Program Design, 5e
  55. 55. Java Programming: From Problem Analysis to Program Design, 5e <ul><li>You can write the Java code of the class Clock using this specification. </li></ul><ul><li>You can also specify the design of a class as it is shown in the programming example, Candy Machine, of this chapter. </li></ul><ul><li>To become an effective and a good programmer, you must avoid the temptation to skip the design phase. </li></ul><ul><li>It is possible that the first few programs that you write can be coded directly. </li></ul><ul><li>In general, this approach works only for very small programs. </li></ul><ul><li>You will spend less time in implementing, debugging, and maintaining a code that is properly designed and documented. </li></ul>
  56. 56. The Reference this <ul><li>Refers to instance variables and methods of a class </li></ul><ul><li>Used to implement cascaded method calls </li></ul>Java Programming: From Problem Analysis to Program Design, 5e
  57. 57. Inner Classes <ul><li>Defined within other classes </li></ul><ul><li>Can be either a complete class definition or anonymous inner class definition </li></ul><ul><li>Used to handle events </li></ul>Java Programming: From Problem Analysis to Program Design, 5e
  58. 58. Abstract Data Types <ul><li>Definition </li></ul><ul><ul><li>- A data type that specifies the logical properties without the implementation details </li></ul></ul>Java Programming: From Problem Analysis to Program Design, 5e
  59. 59. Programming Example: Candy Machine (Problem Statement) Java Programming: From Problem Analysis to Program Design, 5e <ul><li>A new candy machine is bought for the gym, but it is not working properly </li></ul><ul><ul><li>-The machine sells candies, chips, gum, and cookies </li></ul></ul><ul><li>Write a two-part program to create a Java application program for this candy machine so that it can be put into operation </li></ul><ul><ul><li>- In the first part, design a non-GUI application program </li></ul></ul><ul><ul><li>- In the second part, design an application program that will create a GUI as described in the second part </li></ul></ul>
  60. 60. Programming Example: Candy Machine (Problem Statement) (continued) <ul><li>The non-GUI application program should do the following: </li></ul><ul><li>1. Show the customer the different products sold by the candy machine </li></ul><ul><li>2. Let the customer make the selection </li></ul><ul><li>3. Show the customer the cost of the item selected </li></ul><ul><li>4. Accept money from the customer </li></ul><ul><li>5. Release the item </li></ul>Java Programming: From Problem Analysis to Program Design, 5e
  61. 61. Programming Example: Candy Machine (Input and Output) <ul><li>Input: the item selection and the cost of the item </li></ul><ul><li>Output: the selected item </li></ul>Java Programming: From Problem Analysis to Program Design, 5e
  62. 62. Programming Example: Candy Machine <ul><li>Components </li></ul><ul><ul><li>Cash register </li></ul></ul><ul><ul><li>Dispenser </li></ul></ul><ul><ul><li>Machine </li></ul></ul>Java Programming: From Problem Analysis to Program Design, 5e
  63. 63. Programming Example: Candy Machine (continued) Java Programming: From Problem Analysis to Program Design, 5e
  64. 64. Programming Example: Candy Machine (continued) Java Programming: From Problem Analysis to Program Design, 5e
  65. 65. Programming Example: Candy Machine (continued) Java Programming: From Problem Analysis to Program Design, 5e
  66. 66. Programming Example: Candy Machine (continued) Java Programming: From Problem Analysis to Program Design, 5e
  67. 67. Programming Example: Candy Machine (continued) Java Programming: From Problem Analysis to Program Design, 5e
  68. 68. Programming Example: Candy Machine (continued) Java Programming: From Problem Analysis to Program Design, 5e
  69. 69. Chapter Summary <ul><li>Creating classes </li></ul><ul><li>Members of a class </li></ul><ul><ul><li>private </li></ul></ul><ul><ul><li>protected </li></ul></ul><ul><ul><li>public </li></ul></ul><ul><ul><li>static </li></ul></ul><ul><li>Implementing classes </li></ul><ul><li>Various operations on classes </li></ul>Java Programming: From Problem Analysis to Program Design, 5e
  70. 70. Chapter Summary (continued) <ul><li>Constructors </li></ul><ul><li>Finalizers </li></ul><ul><li>Method toString </li></ul><ul><li>Abstract data types </li></ul>Java Programming: From Problem Analysis to Program Design, 5e
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×