Coder Social home page Coder Social logo

java-2-cp2's Introduction

Class Notes Week 4

terminology

  • subclass = child class
  • superclass = parent class

java.lang.Object superclasses

https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html

java.util.ArrayList

https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/ArrayList.html

stick with private

Inheritance

Occurs when a class is derivaed from another class

  • the derived class inheriets the class members of the parent class
  • the methods of the parent class can be used in the child class

Screen Shot 2022-09-16 at 11 54 33 PM

Inheriets the rectangle class members

Polymorphism

  • data types determine which program behavior to execute Objects of a parent class are required to have the parameters of the parent class; however, the objects will be of one of the child classes. Aka upcasting.

Screen Shot 2022-09-16 at 11 55 41 PM

Shape can be any of the shape classes

Abstract methods

  • not implimented in the base class
  • for objects you must impliment abstract methods

Down casting

  • first: ensure it is of a specific shape
  • second: downcast

When to do downcasting:

  • to use specific features of child class

java-2-cp2's People

Contributors

pdj555 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.