tailieunhanh - Lecture Software construction - Lecture 8: Java implementation

Lecture Software construction - Lecture 8: Java implementation (Part 3). After studying this chapter you will be competent at implementing OO designs in Java. The lectures will give you the basic “theory”, but they won’t give you a “working understanding” – you have to do the hard-yards of putting these ideas into practice. | Java Implementation: Part 3 Software Construction Lecture 8 1 Agenda 2 Topics: Enum Types Memory allocation: another view of Java’s type system Object Identity, Assignment, Equality, and Copying The Object class Overriding equals() and toString() Cloning Nested Classes What and Why Reading, in The Java Tutorials: Enum Types and Nested Classes pages, in the Classes and Objects Lesson. Object as a Superclass page, in the Interface and Inheritance Lesson. Equality, Relational, and Conditional Operators page, in the Language Basics Lesson. For reference: The 3 things you should know about hashCode(), Eclipse Source Developer, available 20 March 2013. Learning objectives for this week 3 Students will be competent at implementing OO designs in Java Interfaces, reference data types, abstract classes, intro to generics Visibility, packages, static & dynamic typing, conversion & casting Enums, memory allocation, object identity & assignment & equality & cloning, nested classes The lectures . | Java Implementation: Part 3 Software Construction Lecture 8 1 Agenda 2 Topics: Enum Types Memory allocation: another view of Java’s type system Object Identity, Assignment, Equality, and Copying The Object class Overriding equals() and toString() Cloning Nested Classes What and Why Reading, in The Java Tutorials: Enum Types and Nested Classes pages, in the Classes and Objects Lesson. Object as a Superclass page, in the Interface and Inheritance Lesson. Equality, Relational, and Conditional Operators page, in the Language Basics Lesson. For reference: The 3 things you should know about hashCode(), Eclipse Source Developer, available 20 March 2013. Learning objectives for this week 3 Students will be competent at implementing OO designs in Java Interfaces, reference data types, abstract classes, intro to generics Visibility, packages, static & dynamic typing, conversion & casting Enums, memory allocation, object identity & assignment & equality & cloning, nested classes The lectures will give you the basic “theory”, but they won’t give you a “working understanding” – you have to do the hard-yards of putting these ideas into practice. You won’t even understand the theory, if you listen passively to lectures. I’ll try to help you “learn how to learn” from the Java tutorials. You’ll get many chances to develop your understanding in your lab assignments for this course. Keywords for Control of Inheritance 4 Every subclass will inherit all superclass members that are declared as public or protected . By contrast, private members are not inherited (but may be accessible through super.) The default visibility is “package-private” – inherited by subclasses within the same package, but not inherited by subclasses that are declared outside the package. No subclass can override static methods, or override final methods. Any subclass may add new members (= fields or methods), or override any non-static, non-final method in the superclass. We say a method is overridden in a .