AP Java 1/14/2016 Inheritance Review. Learning Objectives Be able to understand how to create classes that use inheritance. Be able to dry run programs.

Slides:



Advertisements
Similar presentations
Exceptions Session 21. Memory Upload Creating Exceptions Using exceptions to control object creation and validation.
Advertisements

Chapter 8 Inheritance. © 2004 Pearson Addison-Wesley. All rights reserved8-2 Inheritance Inheritance is a fundamental object-oriented design technique.
Lecture 28 More on Exceptions COMP1681 / SE15 Introduction to Programming.
Java Threads Part II. Lecture Objectives To understand the concepts of multithreading in Java To be able to develop simple multithreaded applications.
Java Overview February 4, /4/2004 Assignments Due – Homework 1 Due – Reading and Warmup questions Project 1 – Basic Networking.
Chapter Eight: Arrays 1.Terms and what they mean 2.Types of arrays -One Dimensional arrays -Two Dimensional arrays -ragged arrays -Parallel arrays 3. Methods.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 4 Defining Your Own Classes.
College Board A.P. Computer Science A Topics Program Design - Read and understand a problem's description, purpose, and goals; Apply data abstraction.
Java Quiz Bowl A fun review of the Java you should know from CMPT 201 If you don’t know the answers - this week is for you to study up!
Interfaces. –An interface describes a set of methods: no constructors no instance variables –The interface must be implemented by some class. 646 java.
Encapsulation, Inheritance & Polymorphism. OOP Properties Encapsulation ­The process of creating programs so that information within a class is not accessible.
Introduction to Java Classes and Objects. What is a class A class is description of a structure that contains both data and methods – Describes a set.
JAVA Classes Review. Definitions Class – a description of the attributes and behavior of a set of computational objects Constructor – a method that is.
Object Oriented Programming Examples: C++, Java Advantages: 1. reusibility of code 2. ability to adapt (extend) previously written code.
COS 312 DAY 13 Tony Gauvin. Ch 1 -2 Agenda Questions? First Progress Over due – Next progress report is March 26 Assignment 4 Posted – Chap 6 & 7 – Due.
BallWorld.java A structured walkthrough. Key Features: 2 classes are created Execution is done through the procedure called “main” which are decleared.
Inheritance  Inheritance is a fundamental object-oriented technique  it enhances software design and promotes reuse  We will focus on:  deriving new.
Chapter 8 Inheritance Part 1. © 2004 Pearson Addison-Wesley. All rights reserved8-2 Inheritance Inheritance is a fundamental object-oriented design technique.
Copyright © 2012 Pearson Education, Inc. Chapter 9 Inheritance Java Software Solutions Foundations of Program Design Seventh Edition John Lewis William.
CourseOutline Example & JavaBeans Lec Start with Example Displaying Course Outlines User will select either course “web design & development” or.
Classes. Student class We are tasked with creating a class for objects that store data about students. We first want to consider what is needed for the.
CSE 1341 Honors Professor Mark Fontenot Southern Methodist University Note Set 17.
1 Inheritance  Inheritance allows a software developer to derive a new class from an existing one  The existing class is called the parent class, or.
CSI 3125, Preliminaries, page 1 Compiling the Program.
The assignment expressions. The assignment operator in an assignment statement We have seen the assignment statement: Effect: var = expr; Stores the value.
24-Dec-15 Class Structure. 2 Classes A class describes a set of objects The objects are called instances of the class A class describes: Fields (instance.
Java Programming Final Keyword In Java. final keyword The final keyword in java is used to restrict the user. The final keyword can be used in many context.
Object Oriented Programming I ( ) Dr. Adel hamdan Part 03 (Week 4) Dr. Adel Hamdan Date Created: 7/10/2011.
The ++ and -- expressions. The ++ and -- operators You guessed it: The ++ and -- are operators that return a value.
Java Inheritance 1/13/2015. Learning Objectives Understand how inheritance promotes software reusability Understand notions of superclasses and subclasses.
Software Technology - I Classes Objects Methods (Cont.) A Baby is a Monkey.
AP Computer Science A – Healdsburg High School 1 Unit 9 - Parameter Passing in Java.
1Inheritance  Another fundamental object-oriented technique is called inheritance, which enhances software design and promotes reuse  We will focus on:
Cs205: engineering software university of virginia fall 2006 Programming Exceptionally David Evans
Inheritance Chapter 8 Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013.
Programming in Java Transitioning from Alice. Becomes not myFirstMethod but …. public static void main (String[] arg) { // code for testing classes goes.
Staples are our staple Building upon our solution.
Abstract Classes Java. Learning Objectives Be able to understand and write programs using Abstract Classes.
Web Design & Development Lecture 9
Lecture 12 Inheritance.
Object Oriented Programming
Some Eclipse shortcuts
Chapter 8 Inheritance.
Java Inheritance.
03/10/14 Chapter 9 Inheritance.
Abstract Classes Java.
Java Enter your code from FRQ to Shell
You can work in groups on this program.
CSC 113 Tutorial QUIZ I.
CS1316: Representing Structure and Behavior
Interface.
Java Inheritance.
Java: Getting Started Basic Class Structure
CNT 4007C Project 2 Good morning, everyone. In this class, we will have a brief look at the project 2. Project 2 is basically the same with project 1.
CS1316: Representing Structure and Behavior
Assignment 7 User Defined Classes Part 2
S.VIGNESH Assistant Professor, SECE
COMPUTER 2430 Object Oriented Programming and Data Structures I
Sampath Kumar S Assistant Professor, SECE
class PrintOnetoTen { public static void main(String args[]) {
FOR YOU FOR YOU FOR YOU FOR YOU ~ made with love ~ ~ made with love ~
Constructors, GUI’s(Using Swing) and ActionListner
Sampath Kumar S Assistant Professor, SECE
An Example of Inheritance
Review of Previous Lesson
Java 1/31/2017 Back to Objects.
Chapter 11 Inheritance and Polymorphism Part 1
Java Inheritance.
Presentation transcript:

AP Java 1/14/2016 Inheritance Review

Learning Objectives Be able to understand how to create classes that use inheritance. Be able to dry run programs that involve inheritance.

Outline for the day Dry run a program as a class Take notes on an inheritance unit Program

public class Messages { public static void main(String[] args) { Thought parked = new Thought(); Advice dates = new Advice(); parked.message(); dates.message(); } public class Thought { public void message() { System.out.print("I feel like I'm diagonally parked in "); System.out.println("a parallel universe."); } public class Advice extends Thought { public void message() { System.out.print("Warning: Dates in calendar are closer "); System.out.println("than they appear."); super.message(); }

Inheritance Notes In your notes include…. Questions Ideas: At least one idea from each page of the notes Fill in notes, answer questions before looking at the answer. Code samples

Card Project Create a project with the following classes. Card Class Constructor Instance Variable: name getName method that returns the name setName method that is sent a String and uses it to set the name of the variable. greeting method that displays : name “gets a card” Holiday Card Class Constructor greeting method that displays. “Dear “ name Seasons Greetings! Birthday Card Class Age instance variable Constructor greeting method that displays Dear name Happy age Birthday!! Valentines Class Instance variable kisses Constructor greeting method that displays Dear Name Love and Kisses XXXXXX… (The number of Xs is found in the kisses variable) Driver Class to test each of these